cmake: Extract common config to separate file

Move common parts from config cmake files to separate files.
Remove double slashes from paths.
Add basic sanity check to config cmake files.

Change-Id: I8e7512b2feba23250ddb7ad1340bb4ac5f75a206
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/CommonConfig.cmake b/CommonConfig.cmake
new file mode 100644
index 0000000..e1deb20
--- /dev/null
+++ b/CommonConfig.cmake
@@ -0,0 +1,108 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+if(NOT DEFINED REGRESSION)
+	message(FATAL_ERROR "ERROR: Incomplete Configuration: REGRESSION not defined, Include this file from a Config*.cmake")
+elseif(NOT DEFINED CORE_TEST)
+	message(FATAL_ERROR "ERROR: Incomplete Configuration: CORE_TEST not defined, Include this file from a Config*.cmake")
+elseif(NOT DEFINED BL2)
+	message(FATAL_ERROR "ERROR: Incomplete Configuration: BL2 not defined, Include this file from a Config*.cmake")
+endif()
+
+##Shared compiler and linker settings.
+function(config_setting_shared_flags tgt)
+	embedded_set_target_compile_flags(TARGET ${tgt} LANGUAGE C FLAGS -xc -std=c99 -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse -Wall -Werror)
+	embedded_set_target_link_flags(TARGET ${tgt} FLAGS --strict --map --symbols --xref --entry=Reset_Handler --info=summarysizes,sizes,totals,unused,veneers)
+endfunction()
+
+#Settings which shall be set for all projects the same way based
+# on the variables above.
+set (CORE_TEST_SERVICES OFF)
+set (CORE_TEST_POSITIVE OFF)
+set (CORE_TEST_INTERACTIVE OFF)
+
+if (REGRESSION)
+	set(SERVICES_TEST_ENABLED ON)
+else()
+	set(SERVICES_TEST_ENABLED OFF)
+endif()
+
+if (SERVICES_TEST_ENABLED)
+	set(SERVICE_TEST_S ON)
+	set(SERVICE_TEST_NS ON)
+	set(CORE_TEST_POSITIVE ON)
+	set(CORE_TEST_INTERACTIVE OFF)
+endif()
+
+if (CORE_TEST)
+	set(CORE_TEST_POSITIVE ON)
+	set(CORE_TEST_INTERACTIVE OFF)
+endif()
+
+if(CORE_TEST_INTERACTIVE)
+	add_definitions(-DCORE_TEST_INTERACTIVE)
+	set(TEST_FRAMEWORK_NS ON)
+	set(CORE_TEST_SERVICES ON)
+endif()
+
+if(CORE_TEST_POSITIVE)
+	add_definitions(-DCORE_TEST_POSITIVE)
+	set(TEST_FRAMEWORK_NS ON)
+	set(CORE_TEST_SERVICES ON)
+endif()
+
+if (SERVICE_TEST_S)
+	add_definitions(-DSERVICES_TEST_S)
+	set(TEST_FRAMEWORK_S ON)
+endif()
+
+if (SERVICE_TEST_NS)
+	add_definitions(-DSERVICES_TEST_NS)
+	set(TEST_FRAMEWORK_NS ON)
+endif()
+
+if(TEST_FRAMEWORK_S)
+	add_definitions(-DTEST_FRAMEWORK_S)
+endif()
+
+if(TEST_FRAMEWORK_NS)
+	add_definitions(-DTEST_FRAMEWORK_NS)
+endif()
+
+if (CORE_TEST_SERVICES)
+	add_definitions(-DCORE_TEST_SERVICES)
+endif()
+
+if (BL2)
+	add_definitions(-DBL2)
+endif()
+
+##Secure side
+config_setting_shared_flags(tfm_s)
+embedded_set_target_linker_file(TARGET tfm_s PATH "${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/sse_200_mps2/sse_200/armclang/sse_200_s.sct")
+
+##Non secure side
+config_setting_shared_flags(tfm_ns)
+embedded_set_target_linker_file(TARGET tfm_ns PATH  "${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/sse_200_mps2/sse_200/armclang/sse_200_ns.sct")
+
+##TF-M storage
+config_setting_shared_flags(tfm_storage)
+set(MBEDTLS_C_FLAGS "-D__ARM_FEATURE_CMSE=3 -D__thumb2__ -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse  -DMBEDTLS_CONFIG_FILE=\\\\\\\"mbedtls_config.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/common")
+
+set (SST_ENCRYPTION ON)
+set (SST_RAM_FS ON)
+set (SST_VALIDATE_METADATA_FROM_FLASH ON)
+set (ENABLE_SECURE_STORAGE ON)
+set (MBEDTLS_DEBUG ON)
+
+##Tests
+config_setting_shared_flags(tfm_secure_tests)
+config_setting_shared_flags(tfm_non_secure_tests)
+
+##BL2
+config_setting_shared_flags(mcuboot)
+set(MBEDTLS_C_FLAGS_BL2 "-D__ARM_FEATURE_CMSE=3 -D__thumb2__ -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse  -DMBEDTLS_CONFIG_FILE=\\\\\\\"config-boot.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/bl2/ext/mcuboot/include")
\ No newline at end of file
diff --git a/ConfigCoreTest.cmake b/ConfigCoreTest.cmake
index 5ab23fb..09f1c92 100644
--- a/ConfigCoreTest.cmake
+++ b/ConfigCoreTest.cmake
@@ -1,11 +1,12 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2017, Arm Limited. All rights reserved.
+# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
 #-------------------------------------------------------------------------------
 
 #This file holds information of a specific build configuration of this project.
+
 #Include board specific config (CPU, etc...)
 include("Common/BoardSSE200")
 
@@ -13,6 +14,9 @@
 #build system will work. A file cmake/Common/CompilerArmClangXY.cmake
 #must be present with a matching version.
 include("Common/FindArmClang")
+if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/cmake/Common/${ARMCLANG_MODULE}.cmake")
+	message(FATAL_ERROR "ERROR: Unsupported ARMCLANG compiler version found on PATH.")
+endif()
 include("Common/${ARMCLANG_MODULE}")
 
 ##These variables select how the projects are built. Each project will set
@@ -22,96 +26,5 @@
 set (CORE_TEST True)
 set (BL2 True)
 
-##Shared compiler and linker settings.
-function(config_setting_shared_flags tgt)
-	embedded_set_target_compile_flags(TARGET ${tgt} LANGUAGE C FLAGS -xc -std=c99 -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse -Wall -Werror)
-	embedded_set_target_link_flags(TARGET ${tgt} FLAGS --strict --map --symbols --xref --entry=Reset_Handler --info=summarysizes,sizes,totals,unused,veneers)
-endfunction()
+include ("${CMAKE_CURRENT_LIST_DIR}/CommonConfig.cmake")
 
-#Settings which shall be set for all projects the same way based
-# on the variables above.
-set (CORE_TEST_SERVICES False)
-set (CORE_TEST_POSITIVE False)
-set (CORE_TEST_INTERACTIVE False)
-
-if (REGRESSION)
-	set(SERVICES_TEST_ENABLED True)
-else()
-	set(SERVICES_TEST_ENABLED False)
-endif()
-
-if (SERVICES_TEST_ENABLED)
-	set(SERVICE_TEST_S on)
-	set(SERVICE_TEST_NS on)
-	set(CORE_TEST_POSITIVE on)
-	set(CORE_TEST_INTERACTIVE Off)
-endif()
-
-if (CORE_TEST)
-	set(CORE_TEST_POSITIVE on)
-	set(CORE_TEST_INTERACTIVE OFF)
-endif()
-
-if(CORE_TEST_INTERACTIVE)
-	add_definitions(-DCORE_TEST_INTERACTIVE)
-	set(TEST_FRAMEWORK_NS On)
-	set(CORE_TEST_SERVICES On)
-endif()
-
-if(CORE_TEST_POSITIVE)
-	add_definitions(-DCORE_TEST_POSITIVE)
-	set(TEST_FRAMEWORK_NS On)
-	set(CORE_TEST_SERVICES On)
-endif()
-
-if (SERVICE_TEST_S)
-	add_definitions(-DSERVICES_TEST_S)
-	set(TEST_FRAMEWORK_S On)
-endif()
-
-if (SERVICE_TEST_NS)
-	add_definitions(-DSERVICES_TEST_NS)
-	set(TEST_FRAMEWORK_NS On)
-endif()
-
-if(TEST_FRAMEWORK_S)
-	add_definitions(-DTEST_FRAMEWORK_S)
-endif()
-
-if(TEST_FRAMEWORK_NS)
-	add_definitions(-DTEST_FRAMEWORK_NS)
-endif()
-
-if (CORE_TEST_SERVICES)
-	add_definitions(-DCORE_TEST_SERVICES)
-endif()
-
-if (BL2)
-	add_definitions(-DBL2)
-endif()
-
-##Secure side
-config_setting_shared_flags(tfm_s)
-embedded_set_target_linker_file(TARGET tfm_s PATH "${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/sse_200_mps2/sse_200/armclang/sse_200_s.sct")
-
-#Non secure side
-config_setting_shared_flags(tfm_ns)
-embedded_set_target_linker_file(TARGET tfm_ns PATH  "${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/sse_200_mps2/sse_200/armclang/sse_200_ns.sct")
-
-##TF-M storage
-config_setting_shared_flags(tfm_storage)
-set(MBEDTLS_C_FLAGS "-D__ARM_FEATURE_CMSE=3 -D__thumb2__ -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse  -DMBEDTLS_CONFIG_FILE=\\\\\\\"mbedtls_config.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/common")
-
-set (SST_ENCRYPTION ON)
-set (SST_RAM_FS ON)
-set (SST_VALIDATE_METADATA_FROM_FLASH ON)
-set (ENABLE_SECURE_STORAGE ON)
-set (MBEDTLS_DEBUG ON)
-
-##Tests
-config_setting_shared_flags(tfm_secure_tests)
-config_setting_shared_flags(tfm_non_secure_tests)
-
-##BL2
-config_setting_shared_flags(mcuboot)
-set(MBEDTLS_C_FLAGS_BL2 "-D__ARM_FEATURE_CMSE=3 -D__thumb2__ -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse  -DMBEDTLS_CONFIG_FILE=\\\\\\\"config-boot.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/bl2/ext/mcuboot/include")
diff --git a/ConfigDefault.cmake b/ConfigDefault.cmake
index d9eea39..83b4bf4 100644
--- a/ConfigDefault.cmake
+++ b/ConfigDefault.cmake
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2017, Arm Limited. All rights reserved.
+# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -14,6 +14,9 @@
 #build system will work. A file cmake/Common/CompilerArmClangXY.cmake
 #must be present with a matching version.
 include("Common/FindArmClang")
+if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/cmake/Common/${ARMCLANG_MODULE}.cmake")
+	message(FATAL_ERROR "ERROR: Unsupported ARMCLANG compiler version found on PATH.")
+endif()
 include("Common/${ARMCLANG_MODULE}")
 
 ##These variables select how the projects are built. Each project will set
@@ -23,95 +26,5 @@
 set (CORE_TEST False)
 set (BL2 True)
 
-##Shared compiler and linker settings.
-function(config_setting_shared_flags tgt)
-	embedded_set_target_compile_flags(TARGET ${tgt} LANGUAGE C FLAGS -xc -std=c99 -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse -Wall -Werror)
-	embedded_set_target_link_flags(TARGET ${tgt} FLAGS --strict --map --symbols --xref --entry=Reset_Handler --info=summarysizes,sizes,totals,unused,veneers)
-endfunction()
+include ("${CMAKE_CURRENT_LIST_DIR}/CommonConfig.cmake")
 
-#Settings which shall be set for all projects the same way based
-# on the variables above.
-set (CORE_TEST_SERVICES False)
-set (CORE_TEST_POSITIVE False)
-set (CORE_TEST_INTERACTIVE False)
-if (REGRESSION)
-	set(SERVICES_TEST_ENABLED True)
-else()
-	set(SERVICES_TEST_ENABLED False)
-endif()
-
-if (SERVICES_TEST_ENABLED)
-	set(SERVICE_TEST_S on)
-	set(SERVICE_TEST_NS on)
-	set(CORE_TEST_POSITIVE on)
-	set(CORE_TEST_INTERACTIVE Off)
-endif()
-
-if (CORE_TEST)
-	set(CORE_TEST_POSITIVE on)
-	set(CORE_TEST_INTERACTIVE OFF)
-endif()
-
-if(CORE_TEST_INTERACTIVE)
-	add_definitions(-DCORE_TEST_INTERACTIVE)
-	set(TEST_FRAMEWORK_NS On)
-	set(CORE_TEST_SERVICES On)
-endif()
-
-if(CORE_TEST_POSITIVE)
-	add_definitions(-DCORE_TEST_POSITIVE)
-	set(TEST_FRAMEWORK_NS On)
-	set(CORE_TEST_SERVICES On)
-endif()
-
-if (SERVICE_TEST_S)
-	add_definitions(-DSERVICES_TEST_S)
-	set(TEST_FRAMEWORK_S On)
-endif()
-
-if (SERVICE_TEST_NS)
-	add_definitions(-DSERVICES_TEST_NS)
-	set(TEST_FRAMEWORK_NS On)
-endif()
-
-if(TEST_FRAMEWORK_S)
-	add_definitions(-DTEST_FRAMEWORK_S)
-endif()
-
-if(TEST_FRAMEWORK_NS)
-	add_definitions(-DTEST_FRAMEWORK_NS)
-endif()
-
-if (CORE_TEST_SERVICES)
-	add_definitions(-DCORE_TEST_SERVICES)
-endif()
-
-if (BL2)
-	add_definitions(-DBL2)
-endif()
-
-##Secure side
-config_setting_shared_flags(tfm_s)
-embedded_set_target_linker_file(TARGET tfm_s PATH "${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/sse_200_mps2/sse_200/armclang/sse_200_s.sct")
-
-#Non secure side
-config_setting_shared_flags(tfm_ns)
-embedded_set_target_linker_file(TARGET tfm_ns PATH  "${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/sse_200_mps2/sse_200/armclang/sse_200_ns.sct")
-
-##TF-M storage
-config_setting_shared_flags(tfm_storage)
-set(MBEDTLS_C_FLAGS "-D__ARM_FEATURE_CMSE=3 -D__thumb2__ -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse  -DMBEDTLS_CONFIG_FILE=\\\\\\\"mbedtls_config.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/common")
-
-set (SST_ENCRYPTION ON)
-set (SST_RAM_FS ON)
-set (SST_VALIDATE_METADATA_FROM_FLASH ON)
-set (ENABLE_SECURE_STORAGE ON)
-set (MBEDTLS_DEBUG ON)
-
-##Tests
-config_setting_shared_flags(tfm_secure_tests)
-config_setting_shared_flags(tfm_non_secure_tests)
-
-##BL2
-config_setting_shared_flags(mcuboot)
-set(MBEDTLS_C_FLAGS_BL2 "-D__ARM_FEATURE_CMSE=3 -D__thumb2__ -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse  -DMBEDTLS_CONFIG_FILE=\\\\\\\"config-boot.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/bl2/ext/mcuboot/include")
diff --git a/ConfigRegression.cmake b/ConfigRegression.cmake
index a563d93..e8b6133 100644
--- a/ConfigRegression.cmake
+++ b/ConfigRegression.cmake
@@ -1,16 +1,11 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2017, Arm Limited. All rights reserved.
+# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
 #-------------------------------------------------------------------------------
 
 #This file holds information of a specific build configuration of this project.
-#Process this file only once.
-#if(DEFINED EMBEDDED_PROJ_CONFIG_LOADED)
-# 	return()
-#endif()
-#set(EMBEDDED_PROJ_CONFIG_LOADED True)
 
 #Include board specific config (CPU, etc...)
 include("Common/BoardSSE200")
@@ -19,6 +14,9 @@
 #build system will work. A file cmake/Common/CompilerArmClangXY.cmake
 #must be present with a matching version.
 include("Common/FindArmClang")
+if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/cmake/Common/${ARMCLANG_MODULE}.cmake")
+	message(FATAL_ERROR "ERROR: Unsupported ARMCLANG compiler version found on PATH.")
+endif()
 include("Common/${ARMCLANG_MODULE}")
 
 ##These variables select how the projects are built. Each project will set
@@ -28,95 +26,5 @@
 set (CORE_TEST False)
 set (BL2 True)
 
-##Shared compiler and linker settings.
-function(config_setting_shared_flags tgt)
-	embedded_set_target_compile_flags(TARGET ${tgt} LANGUAGE C FLAGS -xc -std=c99 -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse -Wall -Werror)
-	embedded_set_target_link_flags(TARGET ${tgt} FLAGS --strict --map --symbols --xref --entry=Reset_Handler --info=summarysizes,sizes,totals,unused,veneers)
-endfunction()
+include ("${CMAKE_CURRENT_LIST_DIR}/CommonConfig.cmake")
 
-#Settings which shall be set for all projects the same way based
-# on the variables above.
-set (CORE_TEST_SERVICES False)
-set (CORE_TEST_POSITIVE False)
-set (CORE_TEST_INTERACTIVE False)
-if (REGRESSION)
-	set(SERVICES_TEST_ENABLED True)
-else()
-	set(SERVICES_TEST_ENABLED False)
-endif()
-
-if (SERVICES_TEST_ENABLED)
-	set(SERVICE_TEST_S on)
-	set(SERVICE_TEST_NS on)
-	set(CORE_TEST_POSITIVE on)
-	set(CORE_TEST_INTERACTIVE Off)
-endif()
-
-if (CORE_TEST)
-	set(CORE_TEST_POSITIVE on)
-	set(CORE_TEST_INTERACTIVE OFF)
-endif()
-
-if(CORE_TEST_INTERACTIVE)
-	add_definitions(-DCORE_TEST_INTERACTIVE)
-	set(TEST_FRAMEWORK_NS On)
-	set(CORE_TEST_SERVICES On)
-endif()
-
-if(CORE_TEST_POSITIVE)
-	add_definitions(-DCORE_TEST_POSITIVE)
-	set(TEST_FRAMEWORK_NS On)
-	set(CORE_TEST_SERVICES On)
-endif()
-
-if (SERVICE_TEST_S)
-	add_definitions(-DSERVICES_TEST_S)
-	set(TEST_FRAMEWORK_S On)
-endif()
-
-if (SERVICE_TEST_NS)
-	add_definitions(-DSERVICES_TEST_NS)
-	set(TEST_FRAMEWORK_NS On)
-endif()
-
-if(TEST_FRAMEWORK_S)
-	add_definitions(-DTEST_FRAMEWORK_S)
-endif()
-
-if(TEST_FRAMEWORK_NS)
-	add_definitions(-DTEST_FRAMEWORK_NS)
-endif()
-
-if (CORE_TEST_SERVICES)
-	add_definitions(-DCORE_TEST_SERVICES)
-endif()
-
-if (BL2)
-	add_definitions(-DBL2)
-endif()
-
-##Secure side
-config_setting_shared_flags(tfm_s)
-embedded_set_target_linker_file(TARGET tfm_s PATH "${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/sse_200_mps2/sse_200/armclang/sse_200_s.sct")
-
-#Non secure side
-config_setting_shared_flags(tfm_ns)
-embedded_set_target_linker_file(TARGET tfm_ns PATH  "${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/sse_200_mps2/sse_200/armclang/sse_200_ns.sct")
-
-##TF-M storage
-config_setting_shared_flags(tfm_storage)
-set(MBEDTLS_C_FLAGS "-D__ARM_FEATURE_CMSE=3 -D__thumb2__ -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse  -DMBEDTLS_CONFIG_FILE=\\\\\\\"mbedtls_config.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/platform/ext/target/common")
-
-set (SST_ENCRYPTION ON)
-set (SST_RAM_FS ON)
-set (SST_VALIDATE_METADATA_FROM_FLASH ON)
-set (ENABLE_SECURE_STORAGE ON)
-set (MBEDTLS_DEBUG ON)
-
-##Tests
-config_setting_shared_flags(tfm_secure_tests)
-config_setting_shared_flags(tfm_non_secure_tests)
-
-##BL2
-config_setting_shared_flags(mcuboot)
-set(MBEDTLS_C_FLAGS_BL2 "-D__ARM_FEATURE_CMSE=3 -D__thumb2__ -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse  -DMBEDTLS_CONFIG_FILE=\\\\\\\"config-boot.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/bl2/ext/mcuboot/include")
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 58912a5..7a43f94 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -75,13 +75,13 @@
 #Generate binary file from axf
 compiler_generate_binary_output(${PROJECT_NAME})
 
-#Generate MCUBoot compatiable payload
-if (DEFINED BL2)
-	#Include Python3.x interpreter
-	set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
-	find_package(PythonInterp)
+#Generate MCUBoot compatible payload
+if (BL2)
+	#Find Python3.x interpreter
+	find_package(PythonInterp 3)
+
 	if (NOT PYTHONINTERP_FOUND)
-		message(FATAL_ERROR "Missing Python3.x interpreter, install it!")
+		message(FATAL_ERROR "Failed to find Python3.x interpreter. Pyhton3 must be installed an available on the PATH.")
 	endif()
 
 	set(MCUBOOT_DIR ${TFM_ROOT_DIR}/bl2/ext/mcuboot)
diff --git a/secure_fw/core/CMakeLists.inc b/secure_fw/core/CMakeLists.inc
index 0e17845..eb9e713 100644
--- a/secure_fw/core/CMakeLists.inc
+++ b/secure_fw/core/CMakeLists.inc
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2017, Arm Limited. All rights reserved.
+# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -46,9 +46,9 @@
 embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
 embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/core ABSOLUTE)
 
-set(PLATFORM_DIR ${TFM_ROOT_DIR}/platform)
+set(PLATFORM_DIR ${TFM_ROOT_DIR}/platform/ext)
 embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
 embedded_include_directories(PATH
 	"${PLATFORM_DIR}/target/sse_200_mps2/cmsis_core" ABSOLUTE)
 embedded_include_directories(PATH
-	"${PLATFORM_DIR}//target/sse_200_mps2/sse_200/retarget" ABSOLUTE)
+	"${PLATFORM_DIR}/target/sse_200_mps2/sse_200/retarget" ABSOLUTE)
diff --git a/secure_fw/services/secure_storage/CMakeLists.inc b/secure_fw/services/secure_storage/CMakeLists.inc
index 4590df1..09b3dec 100644
--- a/secure_fw/services/secure_storage/CMakeLists.inc
+++ b/secure_fw/services/secure_storage/CMakeLists.inc
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2017, Arm Limited. All rights reserved.
+# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -83,8 +83,9 @@
 	embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
 	embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/core ABSOLUTE)
 
-	set(PLATFORM_DIR ${TFM_ROOT_DIR}/platform)
+	set(PLATFORM_DIR ${TFM_ROOT_DIR}/platform/ext)
 	embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
+	embedded_include_directories(PATH "${PLATFORM_DIR}/target/common" ABSOLUTE)
 	embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/cmsis_core" ABSOLUTE)
 	embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/retarget" ABSOLUTE)
 endif()
diff --git a/secure_fw/spm/CMakeLists.inc b/secure_fw/spm/CMakeLists.inc
index 1808f66..015d635 100644
--- a/secure_fw/spm/CMakeLists.inc
+++ b/secure_fw/spm/CMakeLists.inc
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2017, Arm Limited. All rights reserved.
+# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -40,7 +40,7 @@
 embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/core ABSOLUTE)
 embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
 
-set(PLATFORM_DIR ${TFM_ROOT_DIR}/platform)
+set(PLATFORM_DIR ${TFM_ROOT_DIR}/platform/ext)
 embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
 embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/cmsis_core" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}//target/sse_200_mps2/sse_200/retarget" ABSOLUTE)
+embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/retarget" ABSOLUTE)
diff --git a/test/test_services/CMakeLists.inc b/test/test_services/CMakeLists.inc
index c5b57bd..14251e5 100644
--- a/test/test_services/CMakeLists.inc
+++ b/test/test_services/CMakeLists.inc
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2017, Arm Limited. All rights reserved.
+# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -45,10 +45,10 @@
 embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
 embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
 
-set(PLATFORM_DIR ${TFM_ROOT_DIR}/platform)
+set(PLATFORM_DIR ${TFM_ROOT_DIR}/platform/ext)
 embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
 embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/cmsis_core" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}//target/sse_200_mps2/sse_200/retarget" ABSOLUTE)
+embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/retarget" ABSOLUTE)
 embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/mps2/mps2_board" ABSOLUTE)