Build: Cmake build system
-- Cmake based build system
-- Only armclang supported currently
Change-Id: I162357439bb1c871cba3a1c614822ef0b7a73e89
Signed-off-by: Abhishek Pandit <abhishek.pandit@arm.com>
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d309db4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,14 @@
+# List of files and extensions to be ignored
+
+# Eclipse projects
+*.project
+*.cproject
+.settings/
+
+# Garbage files
+build/
+objects/
+bin/
+test/*.a
+secure_fw/services/secure_storage/*.o
+secure_fw/services/secure_storage/*.a
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..90d1d70
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,16 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_minimum_required(VERSION 3.7)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+include("Common/BuildSys")
+
+add_subdirectory(app)
+
+#Define a top-level generic tfm project
+project(tfm LANGUAGES)
diff --git a/ConfigCoreTest.cmake b/ConfigCoreTest.cmake
new file mode 100644
index 0000000..dc059a3
--- /dev/null
+++ b/ConfigCoreTest.cmake
@@ -0,0 +1,113 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, 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")
+
+#Use any ARMCLANG version found on PATH. Note: Only versions supported by the
+#build system will work. A file cmake/Common/CompilerArmClangXY.cmake
+#must be present with a matching version.
+include("Common/FindArmClang")
+include("Common/${ARMCLANG_MODULE}")
+
+##These variables select how the projects are built. Each project will set
+#various project specific settings (e.g. what files to build, macro
+#definitions) based on these.
+set (REGRESSION False)
+set (CORE_TEST True)
+set (MCUBOOT False)
+
+##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 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 (MCUBOOT)
+ add_definitions(-DMCUBOOT)
+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)
diff --git a/ConfigDefault.cmake b/ConfigDefault.cmake
new file mode 100644
index 0000000..2f210f4
--- /dev/null
+++ b/ConfigDefault.cmake
@@ -0,0 +1,113 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, 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")
+
+#Use any ARMCLANG version found on PATH. Note: Only versions supported by the
+#build system will work. A file cmake/Common/CompilerArmClangXY.cmake
+#must be present with a matching version.
+include("Common/FindArmClang")
+include("Common/${ARMCLANG_MODULE}")
+
+##These variables select how the projects are built. Each project will set
+#various project specific settings (e.g. what files to build, macro
+#definitions) based on these.
+set (REGRESSION False)
+set (CORE_TEST False)
+set (MCUBOOT False)
+
+##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 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 (MCUBOOT)
+ add_definitions(-DMCUBOOT)
+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)
diff --git a/ConfigRegression.cmake b/ConfigRegression.cmake
new file mode 100644
index 0000000..09958d1
--- /dev/null
+++ b/ConfigRegression.cmake
@@ -0,0 +1,118 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, 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")
+
+#Use any ARMCLANG version found on PATH. Note: Only versions supported by the
+#build system will work. A file cmake/Common/CompilerArmClangXY.cmake
+#must be present with a matching version.
+include("Common/FindArmClang")
+include("Common/${ARMCLANG_MODULE}")
+
+##These variables select how the projects are built. Each project will set
+#various project specific settings (e.g. what files to build, macro
+#definitions) based on these.
+set (REGRESSION True)
+set (CORE_TEST False)
+set (MCUBOOT False)
+
+##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 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 (MCUBOOT)
+ add_definitions(-DMCUBOOT)
+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)
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
new file mode 100644
index 0000000..373d596
--- /dev/null
+++ b/app/CMakeLists.txt
@@ -0,0 +1,127 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_minimum_required(VERSION 3.7)
+
+#Tell cmake where our modules can be found
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake)
+
+#Include common stuff to control cmake.
+include("Common/BuildSys")
+
+#Start an embedded project.
+embedded_project_start(CONFIG "${CMAKE_CURRENT_LIST_DIR}/../ConfigDefault.cmake")
+project(tfm_ns LANGUAGES ASM C)
+embedded_project_fixup()
+
+set(APP_DIR ${CMAKE_CURRENT_LIST_DIR})
+get_filename_component(TFM_ROOT_DIR ${APP_DIR}/.. ABSOLUTE)
+set(INTERFACE_DIR ${TFM_ROOT_DIR}/interface)
+
+#Set variables
+get_filename_component(CMSIS_5_DIR ${TFM_ROOT_DIR}/../CMSIS_5 ABSOLUTE)
+
+if(NOT EXISTS ${CMSIS_5_DIR})
+ message(FATAL_ERROR "Missing CMSIS_5. Please clone the CMSIS_5 repo to directory \"${CMSIS_5_DIR}\".")
+endif()
+
+set(NS_APP_SRC "${CMSIS_5_DIR}/CMSIS/RTOS2/RTX/Config/RTX_Config.c"
+ "${CMSIS_5_DIR}/CMSIS/RTOS2/RTX/Source/rtx_lib.c"
+ "${APP_DIR}/main_ns.c"
+ "${APP_DIR}/ext/tz_context.c"
+ "${APP_DIR}/tfm_integ_test.c"
+ "${APP_DIR}/os_wrapper_rtx.c"
+ "${INTERFACE_DIR}/src/tfm_sst_api.c"
+ "${INTERFACE_DIR}/src/tfm_sst_svc_handler.c"
+ "${INTERFACE_DIR}/src/tfm_id_mngr_dummy.c"
+ "${INTERFACE_DIR}/src/tfm_ns_lock_rtx.c"
+ )
+
+set(MPS2_SSE200_BUILD_CMSIS_CORE On)
+set(MPS2_SSE200_BUILD_RETARGET On)
+set(MPS2_SSE200_BUILD_NATIVE_DRIVERS On)
+set(MPS2_SSE200_BUILD_MPS2_TIME Off)
+set(MPS2_SSE200_BUILD_STARTUP On)
+set(MPS2_SSE200_BUILD_TARGET_CFG Off)
+set(MPS2_SSE200_BUILD_TARGET_HARDWARE_KEYS Off)
+set(MPS2_SSE200_BUILD_CMSIS_DRIVERS On)
+set(MPS2_SSE200_BUILD_UART_STDOUT Off)
+set(MPS2_SSE200_BUILD_MPS2_BOARD_LEDS On)
+set(MPS2_SSE200_BUILD_MPS2_BOARD_TIME On)
+include(${TFM_ROOT_DIR}/platform/ext/Mps2SSE200.cmake)
+
+#Set include directories.
+embedded_target_include_directories(TARGET ${PROJECT_NAME} PATH ${TFM_ROOT_DIR}/common/sct ABSOLUTE APPEND)
+embedded_target_include_directories(TARGET ${PROJECT_NAME} PATH ${INTERFACE_DIR}/include ABSOLUTE APPEND)
+embedded_target_include_directories(TARGET ${PROJECT_NAME} PATH ${TFM_ROOT_DIR} ABSOLUTE APPEND)
+embedded_target_include_directories(TARGET ${PROJECT_NAME} PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE APPEND)
+embedded_target_include_directories(TARGET ${PROJECT_NAME} PATH ${TFM_ROOT_DIR}/secure_fw/core ABSOLUTE APPEND)
+embedded_target_include_directories(TARGET ${PROJECT_NAME} PATH ${CMSIS_5_DIR}/CMSIS/RTOS2/RTX/Include ABSOLUTE APPEND)
+embedded_target_include_directories(TARGET ${PROJECT_NAME} PATH ${CMSIS_5_DIR}/CMSIS/RTOS2/Include ABSOLUTE APPEND)
+embedded_target_include_directories(TARGET ${PROJECT_NAME} PATH ${CMSIS_5_DIR}/CMSIS/RTOS2/RTX/Config ABSOLUTE APPEND)
+
+#Create an executable
+add_executable(${PROJECT_NAME} ${ALL_SRC_C} ${ALL_SRC_C_NS} ${ALL_SRC_ASM_NS} ${NS_APP_SRC})
+#Add the RTX library
+target_link_libraries(${PROJECT_NAME} "${CMSIS_5_DIR}/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MMN.lib")
+#Set macro definitions
+target_compile_definitions(${PROJECT_NAME} PRIVATE __thumb2__ __DOMAIN_NS=1 __ARM_FEATURE_CMSE=3 LOG_MSG_HANDLER_MODE_PRINTF_ENABLED
+ )
+
+if (NOT DEFINED CORE_TEST)
+ message(FATAL_ERROR "Incomplete build configuration: CORE_TEST is undefined. ")
+elseif(CORE_TEST)
+ target_compile_definitions(${PROJECT_NAME} PRIVATE CORE_TEST)
+endif()
+
+if (NOT DEFINED CORE_TEST_SERVICES)
+ message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_SERVICES is undefined. ")
+elseif (CORE_TEST_SERVICES)
+ set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DCORE_TEST_SERVICES\"")
+endif()
+
+#Set MCUBOOT specific settings.
+if (NOT DEFINED MCUBOOT)
+ message(FATAL_ERROR "Incomplete build configuration: MCUBOOT is undefined. ")
+elseif (MCUBOOT)
+ set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DMCUBOOT\"")
+endif()
+
+
+if(NOT TARGET tfm_s)
+ #We need access to the secure veneers. If the location is not already
+ #specified, then set it.
+ if (NOT DEFINED S_VENEER_FILE)
+ set(S_VENEER_FILE "${CMAKE_CURRENT_BINARY_DIR}/s_veneers.o")
+ endif()
+ add_subdirectory(../secure_fw ${CMAKE_CURRENT_BINARY_DIR}/secure_fw)
+endif()
+
+#We depend on the non secure tests. See if the library target is available.
+if(TARGET tfm_non_secure_tests)
+ #If yes, then use the library.
+ target_link_libraries(${PROJECT_NAME} tfm_non_secure_tests)
+ #Ensure library is built first.
+ #add_dependencies(${PROJECT_NAME} tfm_non_secure_tests)
+else()
+ #If not, add the test source to the build.
+ #As of today since secufre_fw is built as a sub-project this code will never
+ #execute.
+ option(ENABLE_INVERT_SERVICE_TESTS "" TRUE)
+ option(ENABLE_SECURE_STORAGE_SERVICE_TESTS "" TRUE)
+ include(../test/CMakeLists.inc)
+ target_sources(${PROJECT_NAME} PUBLIC ${ALL_SRC_C} ${ALL_SRC_C_NS})
+endif()
+
+#Ensure secure_fw is built before our executable.
+add_dependencies(${PROJECT_NAME} tfm_s)
+
+#Add the veneers to the executable.
+set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY LINK_LIBRARIES ${S_VENEER_FILE})
+
+#Finally let cmake system apply changes after the whole project is defined.
+embedded_project_end(${PROJECT_NAME})
diff --git a/cmake/Common/BoardSSE200.cmake b/cmake/Common/BoardSSE200.cmake
new file mode 100644
index 0000000..e4135e5
--- /dev/null
+++ b/cmake/Common/BoardSSE200.cmake
@@ -0,0 +1,11 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Set some global variables our build system uses.
+
+#This board has a Cortex M33 CPU.
+include("Common/CpuM33")
diff --git a/cmake/Common/BuildSys.cmake b/cmake/Common/BuildSys.cmake
new file mode 100644
index 0000000..43e1b90
--- /dev/null
+++ b/cmake/Common/BuildSys.cmake
@@ -0,0 +1,653 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#This file defines project-specific overrides to cmake default behaviour for:
+# * compiler detection
+# * target system detection
+cmake_minimum_required(VERSION 3.3) #IN_LIST was introduced in 3.3
+cmake_policy(SET CMP0057 NEW)
+
+Include(CMakeParseArguments)
+
+#The CMAKE_SYSTEM_XXX settings make cmake to stop applying some target system specific settings.
+#Tell cmake we are compiling for ARM chips.
+set (CMAKE_SYSTEM_PROCESSOR "arm" CACHE INTERNAL "Set target processor type to force cmake include some of our scripts." FORCE)
+#Tell cmake this is an "Embedded" system
+set(CMAKE_SYSTEM_NAME "Embedded" CACHE INTERNAL "Set target system name to force cmake include some of our scripts." FORCE)
+
+#Stop built in CMakeDetermine<lang>.cmake scripts to run.
+set (CMAKE_CXX_COMPILER_ID_RUN 1)
+#Stop cmake run compiler tests.
+set (CMAKE_CXX_COMPILER_FORCED true)
+#Stop built in CMakeDetermine<lang>.cmake scripts to run.
+set (CMAKE_C_COMPILER_ID_RUN 1)
+#Stop cmake run compiler tests.
+set (CMAKE_C_COMPILER_FORCED true)
+
+#This macro is used to enforce the ARM project structure.
+#Inputs: (This macro uses some "global" variables)
+# global variable PROJ_CONFIG - a global configuration file to be used by all projects.
+# It overrides value of CONFIG parameter.
+# CONFIG - the configuration file which shall be used
+#Examples
+# To use global project config:
+# embedded_project_start()
+# To use config file relative to the top level CmakeLists.txt:
+# embedded_project_start(./ConfigDefault.cmake)
+# To use config file relative to the CmakeLists.txt file where this macro is used:
+# embedded_project_start(${CMAKE_CURRENT_LIST_DIR}/ConfigDefault.cmake)
+macro(embedded_project_start)
+ #Default project configuration file
+ if (DEFINED PROJ_CONFIG) #Take the global setting as default value
+ set(_PROJ_CONFIG ${PROJ_CONFIG})
+ endif()
+
+ set( _OPTIONS_ARGS ) #No option (on/off) arguments
+ set( _ONE_VALUE_ARGS CONFIG) #Single option arguments (e.g. PROJ_NAME "bubu_project")
+ set( _MULTI_VALUE_ARGS ) #One list argument (e.g. LANGUAGES C ASM CXX)
+ cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+ #Cehck passed parameters
+ if(NOT _MY_PARAMS_CONFIG)
+ if(NOT DEFINED _PROJ_CONFIG)
+ set(_PROJ_CONFIG "./ConfigDefault.cmake")
+ message(STATUS "embedded_project_start: no project configuration file defined, falling back to default.")
+ endif()
+ elseif(NOT DEFINED PROJ_CONFIG)
+ set(_PROJ_CONFIG ${_MY_PARAMS_CONFIG})
+ endif()
+
+ get_filename_component(_ABS_PROJ_CONFIG ${_PROJ_CONFIG} ABSOLUTE)
+ message( STATUS "embedded_project_start: using project specific config file (PROJ_CONFIG = ${_ABS_PROJ_CONFIG})")
+ include("${_PROJ_CONFIG}")
+endmacro()
+
+#Override CMake default behaviour
+macro(embedded_project_fixup)
+ get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
+ if("CXX" IN_LIST languages)
+ include(Common/CompilerDetermineCXX)
+ #since all CMake "built in" scripts already executed, we need fo fix up some things here.
+ embedded_fixup_build_type_vars(CXX)
+ endif()
+ if("C" IN_LIST languages)
+ include(Common/CompilerDetermineC)
+ embedded_fixup_build_type_vars(C)
+ endif()
+
+ #Merge CPU and configuration specific compiler and linker flags.
+ foreach(LNG ${languages})
+ #Apply CPU specific and configuration specific compile flags.
+ if(NOT CMAKE_${LNG}_FLAGS MATCHES ".*${CMAKE_${LNG}_FLAGS_CPU}.*")
+ set(CMAKE_${LNG}_FLAGS "${CMAKE_${LNG}_FLAGS} ${CMAKE_${LNG}_FLAGS_CPU}")
+ endif()
+ #Fix output file extension.
+ set (CMAKE_EXECUTABLE_SUFFIX_${LNG} ".axf")
+ unset(ALL_SRC_${LNG})
+ unset(ALL_SRC_${LNG}_S)
+ unset(ALL_SRC_${LNG}_NS)
+ endforeach()
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_LINK_FLAGS_CPU}")
+endmacro()
+
+#Allow project specific script to do configuration after all targets are specified; it has to be done for each target defined
+macro (embedded_project_end TARGET)
+ get_property(_MAC DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY MACROS)
+ if ("embedded_project_build_config_apply" IN_LIST _MAC)
+ message(WARNING "embedded_project_end(): macro embedded_project_build_config_apply() is defined. Your build config file may be out-dated.")
+ endif()
+
+ #Apply compile flags.
+ _embedded_apply_compile_flags(${TARGET})
+ #Apply macro definitions
+ _embedded_apply_compile_defines(${TARGET})
+ #Apply include paths
+ _embedded_apply_include_directories(${TARGET})
+ #Apply linker flags.
+ _embedded_apply_link_flags(${TARGET})
+ #If target is executable, apply linker command file setting.
+ get_property(_TGT_TYPE TARGET ${TARGET} PROPERTY TYPE)
+ if(_TGT_TYPE STREQUAL "EXECUTABLE")
+ _embedded_apply_linker_cmd_file_setting(${TARGET})
+ endif()
+endmacro()
+
+macro(embedded_fixup_build_type_vars LANG)
+ #since all CMake "built in" scripts already executed, we need fo fix up some things here.
+ set (CMAKE_${LANG}_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT}" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
+ set (CMAKE_${LANG}_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL_INIT}" CACHE STRING "Flags used by the compiler during release builds for minimum size." FORCE)
+ set (CMAKE_${LANG}_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_INIT}" CACHE STRING "Flags used by the compiler during release builds." FORCE)
+ set (CMAKE_${LANG}_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE)
+endmacro()
+
+
+#Convert a CMake list to a string
+#
+#Examples:
+# list_to_string(my_string 1 2 3 4)
+# list_to_string(my_string ${CMAKE_C_FLAGS})
+#
+#INPUTS:
+# RES - (mandatory) - name of variable to put result in
+# The list to be converted.
+#
+#OUTPUTS
+# List items concatenated to a string.
+#
+function(list_to_string RES)
+ foreach(_ITEM ${ARGN})
+ set(_RES "${_RES} ${_ITEM}")
+ endforeach()
+ set(${RES} "${_RES}" PARENT_SCOPE)
+endfunction()
+
+#Ensure current generator is supported.
+#
+# This function takes a list of supported generators (e.g. "Unix Makefiles") and
+# exits with fatal error is the current generator is not on the list.
+#Examples:
+# assert_generator_is("MSYS Makefiles" "MinGW Makefiles")
+#
+#INPUTS:
+# The list of supported generators.
+#
+#OUTPUTS
+# n/a
+#
+function(assert_generator_is)
+ if (NOT CMAKE_GENERATOR IN_LIST ARGN)
+ message(FATAL_ERROR "assert_generator_is(): Generator '${CMAKE_GENERATOR}' is not on the list of supported generators.")
+ endif()
+endfunction()
+
+#Specify an include path for the compiler
+#
+# Specify a global include directory for all non external targets in the current
+# build.
+# The parameter ABSOLUTE can be set to true to ask CMake to convert the PATH to
+# absolute. This gives better looking command line arguments, and also helps
+# removing duplicates.
+#
+#Examples:
+# embedded_include_directories(PATH "C:/fo/bar/include")
+# embedded_include_directories(PATH "C:/fo/bar/include" ABSOLUTE)
+#
+#INPUTS:
+# PATH - (mandatory) - the include path to add
+# ABSOLUTE - (optional) - whether the path shall be converted to absolute
+#
+#OUTPUTS
+# Modified list of include directories.
+#
+function (embedded_include_directories)
+ #Parse our arguments
+ set( _OPTIONS_ARGS ABSOLUTE) #Option (on/off) arguments (e.g. IGNORE_CASE)
+ set( _ONE_VALUE_ARGS PATH) #Single option arguments (e.g. PATH "./foo/bar")
+ set( _MULTI_VALUE_ARGS ) #List arguments (e.g. LANGUAGES C ASM CXX)
+ cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+ #Check mandatory parameters
+ if(NOT _MY_PARAMS_PATH)
+ failure("embedded_include_directories(): Missing PATH parameter!")
+ endif()
+
+ if(DEFINED _MY_PARAMS_ABSOLUTE AND ${_MY_PARAMS_ABSOLUTE})
+ get_filename_component(_MY_PARAMS_PATH ${_MY_PARAMS_PATH} ABSOLUTE)
+ endif()
+
+ include_directories(${_MY_PARAMS_PATH})
+endfunction()
+
+#Return the language of a source file.
+#
+# Language is either specified by the LANGUAGE property of the source file or
+# determined based on the extension of the file.
+# Search is limited for languages enabled in the current project.
+#
+#Examples:
+# To get language of "foo/bar.c" written into _LNG:
+# embedded_get_source_language("foo/bar.c" _LNG)
+#
+#INPUTS:
+# FILE - (mandatory) - The file to determine language of.
+# RES - (mandatory) - Name of the variable to write the result into.
+#
+#OUTPUTS
+# ${RES} - language string (e.g. "C", "CXX", "ASM"). empty string for files
+# with no language.
+#
+function(embedded_get_source_language FILE RES)
+ if (ARGN)
+ message(FATAL_ERROR "embedded_get_source_language(): too many parameters passed.")
+ endif()
+ #If language property is set, use that.
+ get_property(_LNG SOURCE ${_SRC} PROPERTY LANGUAGE)
+ if (NOT ${_LNG} STREQUAL "")
+ set(${RES} ${_LNG} PARENT_SCOPE)
+ else()
+ #Set empty return value.
+ set(${RES} "" PARENT_SCOPE)
+ #Property not set, use extension of the file to determine
+ #language.
+ string(REGEX MATCH "[^.]*$" _EXT "${_SRC}")
+ #Get list of enabled languages.
+ get_property(_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+ foreach(_LNG ${_LANGUAGES})
+ #See if the extension is contained in the list of file extensions
+ #of this language.
+ if(_EXT IN_LIST CMAKE_${_LNG}_SOURCE_FILE_EXTENSIONS)
+ set(${RES} ${_LNG} PARENT_SCOPE)
+ break()
+ endif()
+ endforeach()
+ endif()
+endfunction()
+
+#Set compilation flags for the specified target.
+#
+# Store compilation flags for the specified target and language pair. Flags are
+# stored in a global property and will
+# be applied to source files in the current directory and sub-directories.
+# Property name must follow a specific scheme (see outputs).
+# See: _embedded_apply_compile_flags()
+#
+#Examples:
+# embedded_set_target_compile_flags(my_app C "-fchar-unsigned")
+# embedded_set_target_compile_flags(my_lib CXX "-fchar-unsigned")
+# embedded_set_target_compile_flags(my_app ASM "-fchar-unsigned")
+#
+#INPUTS:
+# TARGET - (mandatory) - The target to apply settings to.
+# LANGUAGE - (mandatory) - Programming language of source files settings shall
+# be applied to.
+# FLAGS - (mandatory) - List with the compiler flags.
+# APPEND - (optional) - True if FLAGS shall be appended.
+#
+#OUTPUTS
+# Directory property EMBEDDED_COMPILE_FLAGS_TTT_LLL is set, where TTT is the
+# target name, and LLL is the language.
+#
+function (embedded_set_target_compile_flags)
+ set( _OPTIONS_ARGS APPEND) #Option (on/off) arguments (e.g. IGNORE_CASE)
+ set( _ONE_VALUE_ARGS TARGET LANGUAGE) #Single option arguments (e.g. PATH "./foo/bar")
+ set( _MULTI_VALUE_ARGS FLAGS) #List arguments (e.g. LANGUAGES C ASM CXX)
+ cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+ if (NOT DEFINED _MY_PARAMS_TARGET)
+ message(FATAL_ERROR "embedded_set_target_compile_flags(): mandatory parameter 'TARGET' missing.")
+ endif()
+
+ if (NOT DEFINED _MY_PARAMS_LANGUAGE)
+ message(FATAL_ERROR "embedded_set_target_compile_flags(): mandatory parameter 'LANGUAGE' missing.")
+ endif()
+
+ if (NOT DEFINED _MY_PARAMS_FLAGS)
+ message(FATAL_ERROR "embedded_set_target_compile_flags(): mandatory parameter 'FLAGS' missing.")
+ endif()
+
+ if (_MY_PARAMS_APPEND)
+ set_property(GLOBAL APPEND PROPERTY EMBEDDED_COMPILE_FLAGS_${_MY_PARAMS_TARGET}_${_MY_PARAMS_LANGUAGE} ${_MY_PARAMS_FLAGS})
+ else()
+ set_property(GLOBAL PROPERTY EMBEDDED_COMPILE_FLAGS_${_MY_PARAMS_TARGET}_${_MY_PARAMS_LANGUAGE} ${_MY_PARAMS_FLAGS})
+ endif()
+endfunction()
+
+#Apply compilation flag settings for the specified target.
+#
+# Compilation flags stored in a global property and are applied to source files.
+# Note:
+# - Directory property name must follow a specific scheme.
+# - This is an internal function.
+# - This function only supports make and ninja generators.
+#
+# See: embedded_set_target_compile_flags()
+#
+#Examples:
+# _embedded_apply_compile_flags(my_app)
+#
+#INPUTS:
+# TARGET - (mandatory) - The target to apply settings to.
+# Directory property - (optional) - Flags to apply.
+#
+#OUTPUTS
+# n/a
+#
+function(_embedded_apply_compile_flags TARGET)
+ #Check if the parameter is a target.
+ if(NOT TARGET ${TARGET})
+ message(FATAL_ERROR "_embedded_apply_compile_flags(): target '${TARGET}' is not defined.")
+ endif()
+ #Get list of enabled languages.
+ get_property(_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+ foreach(_LNG ${_LANGUAGES})
+ #Get the flags for this language.
+ get_property(_FLAGS GLOBAL PROPERTY EMBEDDED_COMPILE_FLAGS_${TARGET}_${_LNG})
+
+ #The generator expression below is only supported by the make and ninja
+ #generators.
+ assert_generator_is(_GENERATORS_OK "MSYS Makefiles" "MinGW Makefiles" "NMake Makefiles" "NMake Makefiles JOM" "Unix Makefiles" "Watcom WMake" "Ninja")
+ target_compile_options(${TARGET} PRIVATE $<$<COMPILE_LANGUAGE:${_LNG}>:${_FLAGS}>)
+ endforeach()
+endfunction()
+
+#Set compilation defines for the specified target.
+#
+# Store compilation defines for the specified target and language pair. Macros
+# are stored in a global property and will
+# be applied to source files in the current directory and sub-directories.
+# Property name must follow a specific scheme (see outputs).
+# See: _embedded_apply_compile_defines()
+#
+#Examples:
+# embedded_set_target_compile_defines(my_app C "FOO BAR=1")
+# embedded_set_target_compile_defines(my_lib CXX "FOO BAR=1")
+# embedded_set_target_compile_defines(my_app ASM "FOO BAR=1")
+#
+#INPUTS:
+# TARGET - (mandatory) - The target to apply settings to.
+# LANGUAGE - (mandatory) - Programming language of source files settings shall
+# be applied to.
+# DEFINES - (mandatory) - List with the compiler flags.
+# APPEND - (optional) - Present if FLAGS shall be appended.
+#
+#OUTPUTS
+# Directory property EMBEDDED_COMPILE_DEFINES_TTT_LLL is set, where TTT is the
+# target name, and LLL is the language.
+#
+function (embedded_set_target_compile_defines)
+ set( _OPTIONS_ARGS APPEND) #Option (on/off) arguments (e.g. IGNORE_CASE)
+ set( _ONE_VALUE_ARGS TARGET LANGUAGE) #Single option arguments (e.g. PATH "./foo/bar")
+ set( _MULTI_VALUE_ARGS DEFINES) #List arguments (e.g. LANGUAGES C ASM CXX)
+ cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+ if (NOT DEFINED _MY_PARAMS_TARGET)
+ message(FATAL_ERROR "embedded_set_target_compile_defines(): mandatory parameter 'TARGET' missing.")
+ endif()
+
+ if (NOT DEFINED _MY_PARAMS_LANGUAGE)
+ message(FATAL_ERROR "embedded_set_target_compile_defines(): mandatory parameter 'LANGUAGE' missing.")
+ endif()
+
+ if (NOT DEFINED _MY_PARAMS_DEFINES)
+ message(FATAL_ERROR "embedded_set_target_compile_defines(): mandatory parameter 'DEFINES' missing.")
+ endif()
+
+ if (_MY_PARAMS_APPEND)
+ set_property(GLOBAL APPEND PROPERTY EMBEDDED_COMPILE_DEFINES_${_MY_PARAMS_TARGET}_${_MY_PARAMS_LANGUAGE} ${_MY_PARAMS_DEFINES})
+ else()
+ set_property(GLOBAL PROPERTY EMBEDDED_COMPILE_DEFINES_${_MY_PARAMS_TARGET}_${_MY_PARAMS_LANGUAGE} ${_MY_PARAMS_DEFINES})
+ endif()
+endfunction()
+
+#Apply compilation defines for the specified target.
+#
+# Macro definitions are stored in a global property and are applied to
+# source files.
+#
+# Note:
+# - Directory property name must follow a specific scheme.
+# - This is an internal function.
+# - This function only supports make and ninja generators.
+#
+# See: embedded_set_target_compile_defines()
+#
+#Examples:
+# _embedded_apply_compile_defines(my_app)
+#
+#INPUTS:
+# TARGET - (mandatory) - The target to apply settings to.
+# Directory property - (optional) - Flags to apply.
+#
+#OUTPUTS
+# n/a
+#
+function(_embedded_apply_compile_defines TARGET)
+ #Check if the parameter is a target.
+ if(NOT TARGET ${TARGET})
+ message(FATAL_ERROR "_embedded_apply_compile_defines(): target '${TARGET}' is not defined.")
+ endif()
+ #Get list of enabled languages.
+ get_property(_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+ foreach(_LNG ${_LANGUAGES})
+ #Get the flags for this language.
+ get_property(_FLAGS GLOBAL PROPERTY EMBEDDED_COMPILE_DEFINES_${TARGET}_${_LNG})
+ #The generator expression below is only supported by the make and ninja
+ #generators.
+ assert_generator_is(_GENERATORS_OK "MSYS Makefiles" "MinGW Makefiles" "NMake Makefiles" "NMake Makefiles JOM" "Unix Makefiles" "Watcom WMake" "Ninja")
+ target_compile_definitions(${TARGET} PRIVATE $<$<COMPILE_LANGUAGE:${_LNG}>:${_FLAGS}>)
+ endforeach()
+endfunction()
+
+#Specify an include path for the compiler affecting a specific build target (all
+# languages).
+#
+# Store include paths for the specified target. PATH is stored in a global
+# property. The property name must follow a specific scheme (see outputs).
+# See: _embedded_apply_include_directories()
+#
+#Examples:
+# embedded_target_include_directories(TARGET foo PATH "C:/fo/bar/include")
+# embedded_target_include_directories(TARGET foo PATH "C:/fo/bar/include" APPEND)
+# embedded_target_include_directories(TARGET foo PATH "C:/fo/bar/include" ABSOLUTE)
+#
+#INPUTS:
+# ABSOLUTE - (optional)- whether the path shall be converted to absolute
+# APPEND - (optional) - if set append path to existing values
+# PATH - (mandatory) - the include path to add
+# TARGET - (mandatory) - name of target to apply settings to
+#
+#OUTPUTS
+# Directory property EMBEDDED_COMPILE_INCLUDES_TTT is set, where TTT is
+# the target name.
+#
+function (embedded_target_include_directories)
+ #Parse our arguments
+ set( _OPTIONS_ARGS ABSOLUTE APPEND) #Option (on/off) arguments (e.g. IGNORE_CASE)
+ set( _ONE_VALUE_ARGS PATH TARGET) #Single option arguments (e.g. PATH "./foo/bar")
+ set( _MULTI_VALUE_ARGS ) #List arguments (e.g. LANGUAGES C ASM CXX)
+ cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+ #Check mandatory parameters
+ if(NOT _MY_PARAMS_PATH)
+ failure("embedded_target_include_directories(): Missing PATH parameter!")
+ endif()
+
+ if(NOT _MY_PARAMS_TARGET)
+ failure("embedded_target_include_directories(): Missing TARGET parameter!")
+ endif()
+
+ if(DEFINED _MY_PARAMS_ABSOLUTE AND ${_MY_PARAMS_ABSOLUTE})
+ get_filename_component(_MY_PARAMS_PATH ${_MY_PARAMS_PATH} ABSOLUTE)
+ endif()
+
+ if (_MY_PARAMS_APPEND)
+ set_property(GLOBAL APPEND PROPERTY EMBEDDED_COMPILE_INCLUDES_${_MY_PARAMS_TARGET} ${_MY_PARAMS_PATH})
+ else()
+ set_property(GLOBAL PROPERTY EMBEDDED_COMPILE_INCLUDES_${_MY_PARAMS_TARGET} ${_MY_PARAMS_PATH})
+ endif()
+endfunction()
+
+#Apply include path settings for the specified target.
+#
+# Include paths are stored in a global property and are applied to source files.
+# Note:
+# - Directory property name must follow a specific scheme.
+# - This is an internal function.
+#
+# See: embedded_target_include_directories()
+#
+#Examples:
+# _embedded_apply_include_directories(my_app)
+#
+#INPUTS:
+# TARGET - (mandatory) - The target to apply settings to.
+# Directory property - (optional) - Flags to apply.
+#
+#OUTPUTS
+# n/a
+#
+function(_embedded_apply_include_directories TARGET)
+ #Check if the parameter is a target.
+ if(NOT TARGET ${TARGET})
+ message(FATAL_ERROR "_embedded_apply_include_directories(): target '${TARGET}' is not defined.")
+ endif()
+ #Get the flags for this language.
+ get_property(_FLAGS GLOBAL PROPERTY EMBEDDED_COMPILE_INCLUDES_${TARGET})
+ #If we have flags to apply for this language.
+ if (NOT _FLAGS STREQUAL "")
+ target_include_directories(${TARGET} PRIVATE ${_FLAGS})
+ endif()
+endfunction()
+
+#Set linker flags for the specified target.
+#
+# Store linker flags for the specified target in a global property.
+# See: _embedded_apply_link_flags()
+#
+#Examples:
+# embedded_set_target_link_flags(my_app "-M my_map_file.map")
+#
+#INPUTS:
+# TARGET - (mandatory) - The target to apply settings to.
+# FLAGS - (mandatory) - List with the compiler flags.
+# APPEND - (optional) - True if FLAGS shall be appended.
+#
+#OUTPUTS
+# Directory property EMBEDDED_LINKER_FLAGS_TTT is set, where TTT is the
+# target name.
+#
+function(embedded_set_target_link_flags)
+ set( _OPTIONS_ARGS APPEND) #Option (on/off) arguments (e.g. IGNORE_CASE)
+ set( _ONE_VALUE_ARGS TARGET) #Single option arguments (e.g. PATH "./foo/bar")
+ set( _MULTI_VALUE_ARGS FLAGS) #List arguments (e.g. LANGUAGES C ASM CXX)
+ cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+ if (NOT DEFINED _MY_PARAMS_TARGET)
+ message(FATAL_ERROR "embedded_set_target_link_flags(): mandatory parameter 'TARGET' missing.")
+ endif()
+
+ if (NOT DEFINED _MY_PARAMS_FLAGS)
+ message(FATAL_ERROR "embedded_set_target_link_flags(): mandatory parameter 'FLAGS' missing.")
+ endif()
+
+ if (_MY_PARAMS_APPEND)
+ set_property(GLOBAL APPEND PROPERTY EMBEDDED_LINKER_FLAGS_${_MY_PARAMS_TARGET} ${_MY_PARAMS_FLAGS})
+ else()
+ set_property(GLOBAL PROPERTY EMBEDDED_LINKER_FLAGS_${_MY_PARAMS_TARGET} ${_MY_PARAMS_FLAGS})
+ endif()
+endfunction()
+
+#Apply linker flags for the specified target.
+#
+# Linker flags stored in a global property are applied.
+#
+# Note:
+# - Directory property name must follow a specific scheme.
+# - This is an internal function.
+#
+# See: embedded_set_target_link_flags()
+#
+#Examples:
+# _embedded_apply_link_flags(my_app)
+#
+#INPUTS:
+# TARGET - (mandatory) - The target to apply settings to.
+# Directory property - (optional) - Flags to apply.
+#
+#OUTPUTS
+# n/a
+#
+function(_embedded_apply_link_flags TARGET)
+ #Check if the parameter is a target.
+ if(NOT TARGET ${TARGET})
+ message(FATAL_ERROR "_embedded_apply_link_flags(): target '${TARGET}' is not defined.")
+ endif()
+ #Get the stored flags.
+ get_property(_FLAGS GLOBAL PROPERTY EMBEDDED_LINKER_FLAGS_${TARGET})
+ #Apply flags if defined.
+ if (NOT _FLAGS STREQUAL "")
+ list_to_string(_STR_FLAGS ${_FLAGS})
+ set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS ${_STR_FLAGS})
+ endif()
+endfunction()
+
+#Set linker command file for the specified target.
+#
+# Store path to linker command file for the specified target in a global
+# property.
+#
+# See: _embedded_apply_linker_cmd_file_setting()
+#
+#Examples:
+# embedded_set_target_linker_file(my_app "foo/my_linker_cmd.sct")
+#
+#INPUTS:
+# TARGET - (mandatory) - The target to apply settings to.
+# PATH - (mandatory) - Path to linker script.
+#
+#OUTPUTS
+# Directory property EMBEDDED_LINKER_CMD_FILE_TTT is set, where TTT is the
+# target name.
+#
+function(embedded_set_target_linker_file)
+ set( _OPTIONS_ARGS ) #Option (on/off) arguments (e.g. IGNORE_CASE)
+ set( _ONE_VALUE_ARGS TARGET PATH) #Single option arguments (e.g. PATH "./foo/bar")
+ set( _MULTI_VALUE_ARGS ) #List arguments (e.g. LANGUAGES C ASM CXX)
+ cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+ if (NOT DEFINED _MY_PARAMS_TARGET)
+ message(FATAL_ERROR "embedded_set_target_linker_file(): mandatory parameter 'TARGET' missing.")
+ endif()
+
+ if (NOT DEFINED _MY_PARAMS_PATH)
+ message(FATAL_ERROR "embedded_set_target_linker_file(): mandatory parameter 'PATH' missing.")
+ endif()
+
+ set_property(GLOBAL PROPERTY EMBEDDED_LINKER_CMD_FILE_${_MY_PARAMS_TARGET} ${_MY_PARAMS_PATH})
+endfunction()
+
+#Apply linker linker command file setting for the specified target.
+#
+# Path to linker command file stored in a global property is applied.
+#
+# Note:
+# - Directory property name must follow a specific scheme.
+# - This is an internal function.
+#
+# See: embedded_set_target_linker_file()
+#
+#Examples:
+# _embedded_apply_linker_cmd_file_setting(my_app)
+#
+#INPUTS:
+# TARGET - (mandatory) - The target to apply settings to.
+# Directory property - (optional) - Flags to apply.
+#
+#OUTPUTS
+# n/a
+#
+function(_embedded_apply_linker_cmd_file_setting TARGET)
+ #Check if the parameter is a target.
+ if(NOT TARGET ${TARGET})
+ message(FATAL_ERROR "_embedded_apply_linker_cmd_file_setting(): target '${TARGET}' is not defined.")
+ endif()
+ #Check if target is an executable.
+ get_property(_TGT_TYPE TARGET ${TARGET} PROPERTY TYPE)
+ if(NOT _TGT_TYPE STREQUAL "EXECUTABLE")
+ message(FATAL_ERROR "_embedded_apply_linker_cmd_file_setting(): target '${TARGET}' is not an executable.")
+ endif()
+
+ #Check if executable has a linker command file set.
+ get_property(_LINKER_CMD_FILE GLOBAL PROPERTY EMBEDDED_LINKER_CMD_FILE_${TARGET} SET)
+ if (NOT _LINKER_CMD_FILE)
+ message(FATAL_ERROR "_embedded_apply_linker_cmd_file_setting(): Please set linker command file for target '${TARGET}' using embedded_set_target_linker_file().")
+ endif()
+ #Get the path to the linker command file.
+ get_property(_LINKER_CMD_FILE GLOBAL PROPERTY EMBEDDED_LINKER_CMD_FILE_${TARGET})
+ #Set the path
+ compiler_set_linkercmdfile(${TARGET} ${_LINKER_CMD_FILE})
+endfunction()
diff --git a/cmake/Common/CompilerArmClang67.cmake b/cmake/Common/CompilerArmClang67.cmake
new file mode 100644
index 0000000..0ee34b2
--- /dev/null
+++ b/cmake/Common/CompilerArmClang67.cmake
@@ -0,0 +1,64 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#This file contains settings to specify how ARMCLANG shall be used
+
+#Include some dependencies
+Include(Common/CompilerArmClangCommon)
+Include(Common/Utils)
+
+check_armclang_input_vars("6.7")
+
+if(NOT DEFINED ARM_CPU_ARHITECTURE)
+ set(_NO_ARM_CPU_ARHITECTURE true)
+elseif (${ARM_CPU_ARHITECTURE} STREQUAL "ARM8-M-BASE")
+ string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "--target=" VAL "--target=arm-arm-none-eabi")
+ string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "-march=" VAL "-march=armv8-m.base")
+ string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "--target=" VAL "--target=arm-arm-none-eabi")
+ string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-march=" VAL "-march=armv8-m.base")
+ string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "--cpu=" VAL "--cpu=8-M.Base")
+ string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "--cpu=" VAL "--cpu=8-M.Base")
+elseif(${ARM_CPU_ARHITECTURE} STREQUAL "ARM8-M-MAIN")
+ string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "--target=" VAL "--target=arm-arm-none-eabi")
+ string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "-march=" VAL "-march=armv8-m.main")
+ string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "--target=" VAL "--target=arm-arm-none-eabi")
+ string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-march=" VAL "-march=armv8-m.main")
+ string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "--cpu=" VAL "--cpu=8-M.Main")
+ string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "--cpu=" VAL "--cpu=8-M.Main")
+elseif(${ARM_CPU_ARHITECTURE} STREQUAL "V7-M")
+ string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "--target=" VAL "--target=arm-arm-none-eabi")
+ string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "-march=" VAL "-march=armv8-m")
+ string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "--target=" VAL "--target=arm-arm-none-eabi")
+ string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-march=" VAL "-march=armv7-m")
+ string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "--cpu=" VAL "--cpu=7-M")
+ string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "--cpu=" VAL "--cpu=7-M")
+else()
+ message(FATAL_ERROR "Unknown or unsupported ARM cpu architecture setting.")
+endif()
+
+#Prefer arhitecture definition over cpu type.
+if(NOT DEFINED ARM_CPU_ARHITECTURE)
+ if(NOT DEFINED ARM_CPU_TYPE)
+ set(_NO_ARM_CPU_TYPE true)
+ elseif(${ARM_CPU_TYPE} STREQUAL "Cortex-M3")
+ set (CMAKE_C_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m3")
+ set (CMAKE_CXX_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m3")
+ set (CMAKE_ASM_FLAGS_CPU "--cpu=Cortex-M3")
+ set (CMAKE_LINK_FLAGS_CPU "--cpu=Cortex-M3")
+ elseif(${ARM_CPU_TYPE} STREQUAL "Cortex-M33")
+ set (CMAKE_C_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m33")
+ set (CMAKE_CXX_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m33")
+ set (CMAKE_ASM_FLAGS_CPU "--cpu=Cortex-M33")
+ set (CMAKE_LINK_FLAGS_CPU "--cpu=Cortex-M33")
+ else()
+ message(FATAL_ERROR "Unknown ARM cpu setting.")
+ endif()
+endif()
+
+if (_NO_ARM_CPU_TYPE AND _NO_ARM_CPU_ARHITECTURE)
+ message(FATAL_ERROR "Can not set CPU specific compiler flags: neither the ARM CPU type nor the architecture is set.")
+endif()
diff --git a/cmake/Common/CompilerArmClangCommon.cmake b/cmake/Common/CompilerArmClangCommon.cmake
new file mode 100644
index 0000000..4059bdf
--- /dev/null
+++ b/cmake/Common/CompilerArmClangCommon.cmake
@@ -0,0 +1,119 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#This file contains settings to specify how ARMCLANG shall be used
+
+function(check_armclang_input_vars MY_VERSION)
+ #Specify where armclang is
+ if (NOT DEFINED ARMCLANG_PATH)
+ message(FATAL_ERROR "Please set ARMCLANG_PATH to the root directory of the armclang installation. e.g. set(ARMCLANG_PATH \"C:/Program Files/ARMCompiler${MY_VERSION}\")")
+ endif()
+
+ STRING(REGEX REPLACE "([0-9]+).([0-9]+).*" "\\1.\\2" _MY_MAJOR_MINOR "${MY_VERSION}")
+ STRING(REGEX REPLACE "([0-9]+).([0-9]+).*" "\\1.\\2" _ARMCLANG_MAJOR_MINOR "${ARMCLANG_VER}")
+
+ #Check armclang version.
+ if (NOT "${_MY_MAJOR_MINOR}" VERSION_EQUAL "${_ARMCLANG_MAJOR_MINOR}")
+ message(FATAL_ERROR "ARMClang version (ARMCLANG_VER=${ARMCLANG_VER}) does not match ${MY_VERSION}")
+ endif()
+
+ #Emit warning if needed environment variables are not set.
+ if(NOT DEFINED ENV{ARM_TOOL_VARIANT} OR NOT DEFINED ENV{ARM_PRODUCT_PATH})
+ message(WARNING "ARM_TOOL_VARIANT or ARM_PRODUCT_PATH environment variables are not set!")
+ endif()
+
+ if (NOT DEFINED ARM_CPU_ARHITECTURE AND NOT DEFINED ARM_CPU_TYPE)
+ message(FATAL_ERROR "ARM_CPU_TYPE and ARM_CPU_ARHITECTURE is not defined! Please include the CPU specific config file before this one.")
+ endif()
+
+endfunction()
+
+message(STATUS "Using armclang compiler package v${ARMCLANG_VER} from ${ARMCLANG_PATH}")
+
+
+#Tell cmake which compiler we use
+if (EXISTS "c:/")
+ set (CMAKE_C_COMPILER "${ARMCLANG_PATH}/bin/armclang.exe")
+ set (CMAKE_CXX_COMPILER "${ARMCLANG_PATH}/bin/armclang.exe")
+ set (CMAKE_ASM_COMPILER "${ARMCLANG_PATH}/bin/armasm.exe")
+else()
+ set (CMAKE_C_COMPILER "${ARMCLANG_PATH}/bin/armclang")
+ set (CMAKE_CXX_COMPILER "${ARMCLANG_PATH}/bin/armclang")
+ set (CMAKE_ASM_COMPILER "${ARMCLANG_PATH}/bin/armasm")
+endif()
+
+if("CXX" IN_LIST languages)
+ set(CMAKE_CXX_COMPILER_ID "ARMCLANG" CACHE INTERNAL "CXX compiler ID" FORCE)
+ include(Compiler/ARMClang-CXX)
+endif()
+
+if("C" IN_LIST languages)
+ set(CMAKE_C_COMPILER_ID "ARMCLANG" CACHE INTERNAL "C compiler ID" FORCE)
+ include(Compiler/ARMClang-C)
+endif()
+
+if("ASM" IN_LIST languages)
+ set(CMAKE_C_COMPILER_ID "ARMCLANG" CACHE INTERNAL "ASM compiler ID" FORCE)
+ include(Compiler/ARMClang-ASM)
+endif()
+
+function(compiler_set_linkercmdfile TARGET FILE_PATH)
+ #Note: the space before the option is important!
+ set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " --scatter=${FILE_PATH}")
+ set_property(TARGET ${TARGET} APPEND PROPERTY LINK_DEPENDS ${FILE_PATH})
+ #Tell cmake .map files shall be removed when project is cleaned (make clean)
+ get_filename_component(_TARGET_BASE_NAME ${TARGET} NAME_WE)
+ get_directory_property(_ADDITIONAL_MAKE_CLEAN_FILES DIRECTORY "./" ADDITIONAL_MAKE_CLEAN_FILES)
+ set_directory_properties(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_ADDITIONAL_MAKE_CLEAN_FILES} ${_TARGET_BASE_NAME}.map")
+endfunction()
+
+function(compiler_set_cmse_output TARGET FILE_PATH)
+ #Note: the space before the option is important!
+ set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " --import_cmse_lib_out=${FILE_PATH}")
+ #Tell cmake cmse output is a generated object file.
+ SET_SOURCE_FILES_PROPERTIES("${FILE_PATH}" PROPERTIES EXTERNAL_OBJECT true GENERATED true)
+ #Tell cmake cmse output shall be removed by clean target.
+ get_directory_property(_ADDITIONAL_MAKE_CLEAN_FILES DIRECTORY "./" ADDITIONAL_MAKE_CLEAN_FILES)
+ set_directory_properties(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_ADDITIONAL_MAKE_CLEAN_FILES} ${FILE_PATH}")
+endfunction()
+
+function(compiler_merge_library)
+ set( _OPTIONS_ARGS ) #Option (on/off) arguments.
+ set( _ONE_VALUE_ARGS DEST) #Single option arguments.
+ set( _MULTI_VALUE_ARGS LIBS) #List arguments
+ cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+ #Check passed parameters
+ if(NOT _MY_PARAMS_DEST)
+ message(FATAL_ERROR "embedded_merge_library: no destination library target specified.")
+ endif()
+ #Check if destination is a target
+ if(NOT TARGET ${_MY_PARAMS_DEST})
+ message(FATAL_ERROR "embedded_merge_library: parameter DEST must be a target already defined.")
+ endif()
+ #Check if destination is a library
+ get_target_property(_tmp ${_MY_PARAMS_DEST} TYPE)
+ if(NOT "${_tmp}" STREQUAL "STATIC_LIBRARY")
+ message(FATAL_ERROR "embedded_merge_library: parameter DEST must be a static library target.")
+ endif()
+
+ #Check list if libraries to be merged
+ if(NOT _MY_PARAMS_LIBS)
+ message(FATAL_ERROR "embedded_merge_library: no source libraries specified. Please see the LIBS parameter.")
+ endif()
+
+ #Mark each library file as a generated external object. This is needed to
+ #avoid error because CMake has no info how these can be built.
+ SET_SOURCE_FILES_PROPERTIES(
+ ${_MY_PARAMS_LIBS}
+ PROPERTIES
+ EXTERNAL_OBJECT true
+ GENERATED true)
+
+ #Add additional input to target
+ target_sources(${_MY_PARAMS_DEST} PRIVATE ${_MY_PARAMS_LIBS})
+endfunction()
diff --git a/cmake/Common/CompilerDetermineC.cmake b/cmake/Common/CompilerDetermineC.cmake
new file mode 100644
index 0000000..0f6000f
--- /dev/null
+++ b/cmake/Common/CompilerDetermineC.cmake
@@ -0,0 +1,38 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Built in compiler identification does not work for embedded targets, so
+#override it here.
+
+#Stop built in CMakeDetermine<lang>.cmake scripts to run.
+set (CMAKE_C_COMPILER_ID_RUN 1)
+#Stop cmake run compiler tests.
+set (CMAKE_C_COMPILER_FORCED true)
+
+if(NOT DEFINED CMAKE_C_COMPILER)
+ message(FATAL_ERROR "Please set CMAKE_C_COMPILER to hold the full path of \
+your compiler executable")
+endif(NOT DEFINED CMAKE_C_COMPILER)
+
+get_filename_component(_C_COMPILER_NAME ${CMAKE_C_COMPILER} NAME)
+
+#Based on the name of the compiler executable select which tool we use.
+if (_C_COMPILER_NAME MATCHES "^.*armclang(\\.exe)?$")
+ set(CMAKE_C_COMPILER_ID "ARMCLANG" CACHE INTERNAL "C compiler ID" FORCE)
+ set(ARM_TOOLCHAIN_FILE "Compiler/ARMClang-C")
+elseif (_C_COMPILER_NAME MATCHES "^.*gcc(\\.exe)?$")
+ set(CMAKE_C_COMPILER_ID "GNU" CACHE INTERNAL "C compiler ID" FORCE)
+ set(ARM_TOOLCHAIN_FILE "Compiler/GNU-C")
+elseif (_C_COMPILER_NAME MATCHES "^.*iccarm(\\.exe)?$")
+ set(CMAKE_C_COMPILER_ID "IAR" CACHE INTERNAL "C compiler ID" FORCE)
+ set(ARM_TOOLCHAIN_FILE "Compiler/IAR-C")
+else()
+ message(FATAL_ERROR "C Compiler executable ${_C_COMPILER_NAME} is unknown.\
+Please add needed settings to ${CMAKE_CURRENT_LIST_FILE}")
+endif ()
+
+include(${ARM_TOOLCHAIN_FILE})
diff --git a/cmake/Common/CompilerDetermineCXX.cmake b/cmake/Common/CompilerDetermineCXX.cmake
new file mode 100644
index 0000000..d6461c1
--- /dev/null
+++ b/cmake/Common/CompilerDetermineCXX.cmake
@@ -0,0 +1,38 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Built in compiler identification does not work for embedded targets, so
+#override it here.
+
+#Stop built in CMakeDetermine<lang>.cmake scripts to run.
+set (CMAKE_CXX_COMPILER_ID_RUN 1)
+#Stop cmake run compiler tests.
+set (CMAKE_CXX_COMPILER_FORCED true)
+
+if(NOT DEFINED CMAKE_CXX_COMPILER)
+ message(FATAL_ERROR "Please set CMAKE_CXX_COMPILER to hold the full path \
+of your compiler executable")
+endif(NOT DEFINED CMAKE_CXX_COMPILER)
+
+get_filename_component(_CXX_COMPILER_NAME ${CMAKE_CXX_COMPILER} NAME)
+
+if (_CXX_COMPILER_NAME MATCHES "^.*armclang(\\.exe)?$")
+ set(CMAKE_CXX_COMPILER_ID "ARMCLANG" CACHE INTERNAL "C++ compiler ID" FORCE)
+ set(ARM_TOOLCHAIN_FILE "Compiler/ARMClang-CXX")
+elseif (_CXX_COMPILER_NAME MATCHES "^.*gcc(\\.exe)?$")
+ set(CMAKE_CXX_COMPILER_ID "GNU" CACHE INTERNAL "C++ compiler ID" FORCE)
+ set(ARM_TOOLCHAIN_FILE "Compiler/GNU-CXX")
+elseif (_CXX_COMPILER_NAME MATCHES "^.*iccarm(\\.exe)?$")
+ set(CMAKE_CXX_COMPILER_ID "IAR" CACHE INTERNAL "C++ compiler ID" FORCE)
+ set(ARM_TOOLCHAIN_FILE "Compiler/IAR-CXX")
+else()
+ message(FATAL_ERROR "C++ Compiler executable ${_C_COMPILER_NAME} is \
+unknown. Please add needed settings to ${CMAKE_CURRENT_LIST_FILE}")
+endif ()
+
+include(${ARM_TOOLCHAIN_FILE})
+
diff --git a/cmake/Common/CpuM33.cmake b/cmake/Common/CpuM33.cmake
new file mode 100644
index 0000000..69bafe6
--- /dev/null
+++ b/cmake/Common/CpuM33.cmake
@@ -0,0 +1,11 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#This file gathers Cortex-M33 specific settings which control the build system.
+set(ARM_CPU_ARHITECTURE "ARM8-M-MAIN")
+
+set(ARM_CPU_TYPE "Cortex-M33")
diff --git a/cmake/Common/FindArmClang.cmake b/cmake/Common/FindArmClang.cmake
new file mode 100644
index 0000000..7e02f51
--- /dev/null
+++ b/cmake/Common/FindArmClang.cmake
@@ -0,0 +1,113 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Find the location of the ARMClang C/C++ compiler.
+#
+# Find armclang on the specified location or on the PATH and optionally validate its version.
+#
+#Inputs:
+# ARMCLANG_PATH - (optional)- install path of armclang compiler to use. If not set the
+# compiler on the PATH is used.
+# ARMCLANG_VER - (optional)- version number. If set the module will validate the compiler version.
+#
+#outputs:
+# ARMCLANG_PATH - will be set to the root directory of the compiler. Only set if undefined.
+# ARMCLANG_VER - will be set to the version number found. Only set if undefined.
+# ARMCLANG_MODULE - set to the name of the cmake module to be included for this ARMClang version.
+#
+
+#Include some dependencies
+Include(Common/Utils)
+
+#Get the version of armasm.
+#
+# Execute armasm and extract its version number for its output.
+#
+#Exmaples:
+# Get the version reported by armasm at location c:/foo/bin/armasm to variable VER
+# get_armasm_version(ARMASM "c:/foo/bin/armasm" RES VER)
+#
+#INPUTS:
+# ARMASM - (mandatory) - armasm executable
+# RES - (mandatory) - variable name to put result to
+#
+#OUTPUTS
+# The variable named after "RES" will be set to the version number matches
+#
+function(get_armasm_version)
+ #Parse our arguments
+ set( _OPTIONS_ARGS ) #No option (on/off) arguments (e.g. IGNORE_CASE)
+ set( _ONE_VALUE_ARGS ARMASM RES) #Single option arguments (e.g. PATH "./foo/bar")
+ set( _MULTI_VALUE_ARGS ) #One list argument (e.g. LANGUAGES C ASM CXX)
+ cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+ #Check mandatory parameters
+ if(NOT _MY_PARAMS_RES)
+ message (FATAL_ERROR "get_armasm_version(): Missing result parameter!")
+ endif()
+ set (_RES ${_MY_PARAMS_RES})
+
+ if(NOT _MY_PARAMS_ARMASM)
+ message (FATAL_ERROR "get_armasm_version(): Missing ARMASM parameter!")
+ endif()
+ set (_ARMASM ${_MY_PARAMS_ARMASM})
+
+ #Call specified executable
+ execute_process(COMMAND "${_ARMASM}"
+ OUTPUT_VARIABLE _OUTPUT
+ ERROR_VARIABLE _OUTPUT
+ )
+ #Cut off version number. Just the numbers ignore anything after.
+ STRING(REGEX REPLACE ".*ARM Compiler (([0-9]+\.)+[0-9]+).*" "\\1" _VER "${_OUTPUT}")
+
+ if (NOT _VER)
+ message (FATAL_ERROR "get_armasm_version(): Failed to extract version number from armasm output.")
+ endif()
+
+ set(${_RES} ${_VER} PARENT_SCOPE)
+endfunction()
+
+#If the install location needs to be found.
+if(NOT DEFINED ARMCLANG_PATH)
+ #Set ARMCLANG_PATH to default value.
+ set (ARMCLANG_PATH "ARMCLANG_PATH-NOTFOUND")
+
+ #First check if armclang is on the PATH
+ #find_program puts() its output to the cmake cache. We don't want that, so we use a local variable, which
+ #is unset later.
+ find_program (
+ _ARMCLANG_PATH
+ armclang
+ PATHS env PATH
+ DOC "ARMCLANG compiler location."
+ )
+
+ #Yes, check the version number if it is specified.
+ if(_ARMCLANG_PATH STREQUAL "_ARMCLANG_PATH-NOTFOUND")
+ message (FATAL_ERROR "armclang install location is unset. Either put armclang on the PATH or set ARMCLANG_PATH.")
+ endif()
+
+ #Cut off executable name directory name to get install location.
+ STRING(REGEX REPLACE "(.*)/bin/armclang.*" "\\1" ARMCLANG_PATH "${_ARMCLANG_PATH}")
+
+ #Remove unwanted junk from CMake cache.
+ unset(_ARMCLANG_PATH CACHE)
+endif()
+
+get_armasm_version(ARMASM "${ARMCLANG_PATH}/bin/armasm" RES _VER)
+
+#Check the version if needed
+if(NOT DEFINED ARMCLANG_VER)
+ set(ARMCLANG_VER ${_VER})
+endif()
+
+if(NOT "${ARMCLANG_VER}" VERSION_EQUAL "${_VER}")
+ message (FATAL_ERROR "FindArmClang.cmake: armclang compiler version ${_VER} does not match ${ARMCLANG_VER}.")
+endif()
+
+STRING(REGEX REPLACE "([0-9]+)\.([0-9]+)(\.[0-9]+)*.*" "CompilerArmClang\\1\\2" ARMCLANG_MODULE "${ARMCLANG_VER}")
+
diff --git a/cmake/Common/Utils.cmake b/cmake/Common/Utils.cmake
new file mode 100644
index 0000000..0c3b0d0
--- /dev/null
+++ b/cmake/Common/Utils.cmake
@@ -0,0 +1,52 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+# Append a value to a string if not already present
+#
+# Append an item to a string if no item with matching key is already on the string.
+# This function's intended purpose is to append unique flags to command line switches.
+#
+# Examples:
+# string_append_unique_item(STRING C_FLAGS KEY "--target" VAL "--target=armv8m-arm-none-eabi")
+#
+# INPUTS:
+# STRING - (mandatory) - name of the string to operate on
+# KEY - (mandatory) - string to look for
+# VAL - (mandatory) - value to put be added to the string
+#
+# OUTPUTS
+# STRING is modified as needed.
+#
+function(string_append_unique_item)
+ #Parse our arguments
+ set( _OPTIONS_ARGS ) #No option (on/off) arguments (e.g. IGNORE_CASE)
+ set( _ONE_VALUE_ARGS STRING KEY VAL) #Single option arguments (e.g. PATH "./foo/bar")
+ set( _MULTI_VALUE_ARGS ) #List arguments (e.g. LANGUAGES C ASM CXX)
+ cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+ #Check mandatory parameters
+ if(NOT _MY_PARAMS_STRING)
+ failure("string_append_unique_item(): Missing STRING parameter!")
+ endif()
+ set(_STRING ${_MY_PARAMS_STRING})
+
+ if(NOT _MY_PARAMS_KEY)
+ failure("string_append_unique_item(): Missing KEY parameter!")
+ endif()
+ set(_KEY ${_MY_PARAMS_KEY})
+
+ if(NOT _MY_PARAMS_VAL)
+ failure("string_append_unique_item(): Missing VAL parameter!")
+ endif()
+ set(_VAL ${_MY_PARAMS_VAL})
+
+ #Scan the string.
+ STRING(REGEX MATCH "( |^) *${_KEY}" _FOUND "${${_STRING}}")
+ if("${_FOUND}" STREQUAL "")
+ set(${_STRING} "${${_STRING}} ${_VAL}" PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/cmake/Compiler/ARMClang-ASM.cmake b/cmake/Compiler/ARMClang-ASM.cmake
new file mode 100644
index 0000000..576a2b3
--- /dev/null
+++ b/cmake/Compiler/ARMClang-ASM.cmake
@@ -0,0 +1,10 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+include(Compiler/ARMClang)
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm)
+__compiler_armclang(ASM)
diff --git a/cmake/Compiler/ARMClang-C.cmake b/cmake/Compiler/ARMClang-C.cmake
new file mode 100644
index 0000000..fc3947b
--- /dev/null
+++ b/cmake/Compiler/ARMClang-C.cmake
@@ -0,0 +1,9 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+include(Compiler/ARMClang)
+__compiler_armclang(C)
diff --git a/cmake/Compiler/ARMClang-CXX.cmake b/cmake/Compiler/ARMClang-CXX.cmake
new file mode 100644
index 0000000..bf336fd
--- /dev/null
+++ b/cmake/Compiler/ARMClang-CXX.cmake
@@ -0,0 +1,9 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+include(Compiler/ARMClang)
+__compiler_armclang(CXX)
diff --git a/cmake/Compiler/ARMClang.cmake b/cmake/Compiler/ARMClang.cmake
new file mode 100644
index 0000000..5390a98
--- /dev/null
+++ b/cmake/Compiler/ARMClang.cmake
@@ -0,0 +1,47 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+if(_ARMCCLANG_CMAKE_LOADED)
+ return()
+endif()
+set(_ARMCCLANG_CMAKE_LOADED TRUE)
+
+get_filename_component(_CMAKE_C_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH)
+get_filename_component(_CMAKE_CXX_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH)
+
+set(CMAKE_EXECUTABLE_SUFFIX ".axf")
+
+find_program(CMAKE_ARMCCLANG_LINKER armlink HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
+find_program(CMAKE_ARMCCLANG_AR armar HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
+
+set(CMAKE_LINKER "${CMAKE_ARMCCLANG_LINKER}" CACHE FILEPATH "The ARMCC linker" FORCE)
+mark_as_advanced(CMAKE_ARMCCLANG_LINKER)
+set(CMAKE_AR "${CMAKE_ARMCCLANG_AR}" CACHE FILEPATH "The ARMCC archiver" FORCE)
+mark_as_advanced(CMAKE_ARMCCLANG_AR)
+
+macro(__compiler_armclang lang)
+ if(NOT CMAKE_${lang}_FLAGS_SET)
+ set(CMAKE_${lang}_FLAGS_SET TRUE)
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -O0")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Oz -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O3 -g")
+
+ set(CMAKE_${lang}_OUTPUT_EXTENSION ".o")
+ set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1)
+ set(CMAKE_STATIC_LIBRARY_PREFIX_${lang} "")
+ set(CMAKE_STATIC_LIBRARY_SUFFIX_${lang} ".a")
+
+ set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> --list <TARGET_BASE>.map")
+ set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+
+ set(CMAKE_DEPFILE_FLAGS_${lang} "--depend=<DEPFILE> --depend_single_line --no_depend_system_headers")
+ endif()
+endmacro()
diff --git a/cmake/Platform/Embedded.cmake b/cmake/Platform/Embedded.cmake
new file mode 100644
index 0000000..edc40e7
--- /dev/null
+++ b/cmake/Platform/Embedded.cmake
@@ -0,0 +1,17 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Force extension for object files to be '.o'.
+set(CMAKE_C_OUTPUT_EXTENSION ".o" CACHE STRING "" FORCE)
+
+# Set a variable to indicate whether the value of CMAKE_INSTALL_PREFIX
+# was initialized by the block below. This is useful for user
+# projects to change the default prefix while still allowing the
+# command line to override it.
+if(NOT DEFINED CMAKE_INSTALL_PREFIX)
+ set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 1)
+endif()
diff --git a/log.bat b/log.bat
new file mode 100644
index 0000000..e5b20e9
--- /dev/null
+++ b/log.bat
@@ -0,0 +1,10 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+@echo off
+PATH=%PATH%;C:\cygwin64\bin
+bash.exe %~dp0/log.sh %*
diff --git a/log.sh b/log.sh
new file mode 100755
index 0000000..288c0f4
--- /dev/null
+++ b/log.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+if [ ! -e "c:/" ]
+then
+function cygpath {
+ readlink -f "$2"
+}
+fi
+
+file=`readlink -e ${@:$#:1}`
+cmd=`which ${@:1:1}` || cmd=${@:1:1}
+cmd=`cygpath -m "$cmd"`
+cat <<EOM
+{
+ "directory": "`cygpath -m "$PWD"`",
+ "command": "\"$cmd\" ${@:2:(( $#-1 ))}",
+ "file": "`cygpath -m "$file"`"
+},
+EOM
+
diff --git a/platform/ext/Mps2SSE200.cmake b/platform/ext/Mps2SSE200.cmake
new file mode 100644
index 0000000..624ff89
--- /dev/null
+++ b/platform/ext/Mps2SSE200.cmake
@@ -0,0 +1,110 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#This file gathers all MPS2/SSE2 specific files in the application.
+
+set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR})
+
+set(BOARD_ID "mps2")
+set(SUBYSTEM_ID "sse_200")
+
+embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
+embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE)
+embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2" ABSOLUTE)
+embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/cmsis_core" ABSOLUTE)
+embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/mps2/specific_drivers" ABSOLUTE)
+embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/mps2/mps2_board" ABSOLUTE)
+embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/sse_200" 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/native_drivers" ABSOLUTE)
+embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/partition" ABSOLUTE)
+
+#Gather all source files we need.
+if (NOT DEFINED MPS2_SSE200_BUILD_CMSIS_CORE)
+ message(FATAL_ERROR "Configuration variable MPS2_SSE200_BUILD_CMSIS_CORE (true|false) is undefined!")
+elseif(MPS2_SSE200_BUILD_CMSIS_CORE)
+ list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/sse_200_mps2/cmsis_core/system_cmsdk_mps2_sse_200.c")
+endif()
+
+if (NOT DEFINED MPS2_SSE200_BUILD_RETARGET)
+ message(FATAL_ERROR "Configuration variable MPS2_SSE200_BUILD_RETARGET (true|false) is undefined!")
+elseif(MPS2_SSE200_BUILD_RETARGET)
+ list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/retarget/platform_retarget_dev.c")
+endif()
+
+if (NOT DEFINED MPS2_SSE200_BUILD_UART_STDOUT)
+ message(FATAL_ERROR "Configuration variable MPS2_SSE200_BUILD_UART_STDOUT (true|false) is undefined!")
+elseif(MPS2_SSE200_BUILD_UART_STDOUT)
+ LIST(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/common/uart_stdout.c")
+ embedded_include_directories(PATH "${PLATFORM_DIR}/target/common" ABSOLUTE)
+ set(MPS2_SSE200_BUILD_NATIVE_DRIVERS true)
+ set(MPS2_SSE200_BUILD_CMSIS_DRIVERS true)
+endif()
+
+if (NOT DEFINED MPS2_SSE200_BUILD_NATIVE_DRIVERS)
+ message(FATAL_ERROR "Configuration variable MPS2_SSE200_BUILD_NATIVE_DRIVERS (true|false) is undefined!")
+elseif(MPS2_SSE200_BUILD_NATIVE_DRIVERS)
+ list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/native_drivers/arm_uart_drv.c")
+
+ list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/native_drivers/mpc_sie200_drv.c"
+ "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/native_drivers/ppc_sse200_drv.c"
+ )
+endif()
+
+if (NOT DEFINED MPS2_SSE200_BUILD_MPS2_TIME)
+ message(FATAL_ERROR "Configuration variable MPS2_SSE200_BUILD_MPS2_TIME (true|false) is undefined!")
+elseif(MPS2_SSE200_BUILD_MPS2_TIME)
+ LIST(APPEND ALL_SRC_C "${PLATFORM_DIR}//target/sse_200_mps2/sse_200/native_drivers/timer_cmsdk/timer_cmsdk.c")
+ embedded_include_directories(PATH "${PLATFORM_DIR}//target/sse_200_mps2/sse_200/native_drivers/timer_cmsdk" ABSOLUTE)
+endif()
+
+if (NOT DEFINED MPS2_SSE200_BUILD_STARTUP)
+ message(FATAL_ERROR "Configuration variable MPS2_SSE200_BUILD_STARTUP (true|false) is undefined!")
+elseif(MPS2_SSE200_BUILD_STARTUP)
+ if(CMAKE_C_COMPILER_ID STREQUAL "ARMCLANG")
+ list(APPEND ALL_SRC_ASM_S "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/armclang/startup_cmsdk_sse_200_s.s")
+ list(APPEND ALL_SRC_ASM_NS "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/armclang/startup_cmsdk_sse_200_ns.s")
+ else()
+ message(FATAL_ERROR "No startup file is available for compiler '${CMAKE_C_COMPILER_ID}'.")
+ endif()
+endif()
+
+if (NOT DEFINED MPS2_SSE200_BUILD_TARGET_CFG)
+ message(FATAL_ERROR "Configuration variable MPS2_SSE200_BUILD_TARGET_CFG (true|false) is undefined!")
+elseif(MPS2_SSE200_BUILD_TARGET_CFG)
+ list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/sse_200_mps2/target_cfg.c")
+endif()
+
+if (NOT DEFINED MPS2_SSE200_BUILD_TARGET_HARDWARE_KEYS)
+ message(FATAL_ERROR "Configuration variable MPS2_SSE200_BUILD_TARGET_HARDWARE_KEYS (true|false) is undefined!")
+elseif(MPS2_SSE200_BUILD_TARGET_HARDWARE_KEYS)
+ LIST(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/sse_200_mps2/dummy_crypto_keys.c")
+endif()
+
+if (NOT DEFINED MPS2_SSE200_BUILD_CMSIS_DRIVERS)
+ message(FATAL_ERROR "Configuration variable MPS2_SSE200_BUILD_CMSIS_DRIVERS (true|false) is undefined!")
+elseif(MPS2_SSE200_BUILD_CMSIS_DRIVERS)
+ LIST(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/cmsis_drivers/Driver_MPC.c"
+ "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/cmsis_drivers/Driver_PPC.c")
+ LIST(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/cmsis_drivers/Driver_USART.c")
+ embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/sse_200/cmsis_drivers" ABSOLUTE)
+ embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE)
+endif()
+
+if (NOT DEFINED MPS2_SSE200_BUILD_MPS2_BOARD_LEDS)
+ message(FATAL_ERROR "Configuration variable MPS2_SSE200_BUILD_MPS2_BOARD_LEDS (true|false) is undefined!")
+elseif(MPS2_SSE200_BUILD_MPS2_BOARD_LEDS)
+ LIST(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/sse_200_mps2/mps2/mps2_board/mps2_leds.c")
+ embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/mps2/mps2_board" ABSOLUTE)
+endif()
+
+if (NOT DEFINED MPS2_SSE200_BUILD_MPS2_BOARD_TIME)
+ message(FATAL_ERROR "Configuration variable MPS2_SSE200_BUILD_MPS2_BOARD_TIME (true|false) is undefined!")
+elseif(MPS2_SSE200_BUILD_MPS2_BOARD_TIME)
+ LIST(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/sse_200_mps2/mps2/mps2_board/mps2_time.c")
+ embedded_include_directories(PATH "${PLATFORM_DIR}/target/sse_200_mps2/mps2/mps2_board" ABSOLUTE)
+endif()
diff --git a/secure_fw/CMakeLists.txt b/secure_fw/CMakeLists.txt
new file mode 100644
index 0000000..8ce4e01
--- /dev/null
+++ b/secure_fw/CMakeLists.txt
@@ -0,0 +1,111 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_minimum_required(VERSION 3.7)
+
+#Tell cmake where our modules can be found
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake)
+
+#Include common stuff to control cmake.
+include("Common/BuildSys")
+
+#Start an embedded project.
+embedded_project_start(CONFIG "${CMAKE_CURRENT_LIST_DIR}/../ConfigDefault.cmake")
+project(tfm_s LANGUAGES ASM C)
+embedded_project_fixup()
+
+set (SECURE_FW_DIR "${CMAKE_CURRENT_LIST_DIR}")
+set (TFM_ROOT_DIR "${SECURE_FW_DIR}/..")
+set (TEST_DIR "${TFM_ROOT_DIR}/test")
+set (INTERFACE_DIR "${TFM_ROOT_DIR}/interface")
+
+if(CORE_TEST)
+ set (TFM_LVL 3)
+else()
+ set (TFM_LVL 1)
+endif()
+
+include(${SECURE_FW_DIR}/spm/CMakeLists.inc)
+include(${SECURE_FW_DIR}/core/CMakeLists.inc)
+include(${SECURE_FW_DIR}/ns_callable/CMakeLists.inc)
+
+set(MPS2_SSE200_BUILD_CMSIS_CORE On)
+set(MPS2_SSE200_BUILD_RETARGET On)
+set(MPS2_SSE200_BUILD_NATIVE_DRIVERS On)
+set(MPS2_SSE200_BUILD_STARTUP On)
+set(MPS2_SSE200_BUILD_TARGET_CFG On)
+set(MPS2_SSE200_BUILD_TARGET_HARDWARE_KEYS On)
+set(MPS2_SSE200_BUILD_CMSIS_DRIVERS On)
+set(MPS2_SSE200_BUILD_MPS2_TIME Off)
+set(MPS2_SSE200_BUILD_UART_STDOUT On)
+set(MPS2_SSE200_BUILD_MPS2_BOARD_LEDS Off)
+set(MPS2_SSE200_BUILD_MPS2_BOARD_TIME On)
+include(${TFM_ROOT_DIR}/platform/ext/Mps2SSE200.cmake)
+
+embedded_target_include_directories(TARGET ${PROJECT_NAME} PATH ${TFM_ROOT_DIR} ABSOLUTE APPEND)
+
+#Specify what we build
+add_executable(${PROJECT_NAME} ${ALL_SRC_C} ${ALL_SRC_C_S} ${ALL_SRC_ASM_S})
+
+#Adds the test directory
+add_subdirectory(${TFM_ROOT_DIR}/test ${CMAKE_BINARY_DIR}/test)
+
+#Add the secure storage library target
+add_subdirectory(${SECURE_FW_DIR}/services/secure_storage)
+
+add_dependencies(${PROJECT_NAME} tfm_storage)
+add_dependencies(${PROJECT_NAME} tfm_secure_tests)
+
+#Set macro definitions for the project.
+embedded_set_target_compile_defines(TARGET ${PROJECT_NAME} LANGUAGE C DEFINES __thumb2__ __ARM_FEATURE_CMSE=3 TFM_LVL=${TFM_LVL} DAUTH_CHIP_DEFAULT APPEND)
+target_link_libraries(${PROJECT_NAME} tfm_storage tfm_secure_tests)
+
+set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS " --predefine=\"-DTFM_LVL=${TFM_LVL}\"")
+
+if (NOT DEFINED CORE_TEST_SERVICES)
+ message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_SERVICES is undefined. ")
+elseif (CORE_TEST_SERVICES)
+ set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DCORE_TEST_SERVICES\"")
+endif()
+
+if (NOT DEFINED MCUBOOT)
+ message(FATAL_ERROR "Incomplete build configuration: MCUBOOT is undefined. ")
+elseif (MCUBOOT)
+ set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DMCUBOOT\"")
+endif()
+
+if(CORE_TEST)
+ embedded_set_target_compile_defines(TARGET ${PROJECT_NAME} LANGUAGE C DEFINES TFM_CORE_DEBUG CORE_TEST_SERVICES APPEND)
+ set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/unit_test")
+ set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "--predefine=\"-DCORE_TEST_SERVICES\"")
+endif()
+
+#Configure where we put the CMSE veneers generated by the compiler.
+if (NOT DEFINED S_VENEER_FILE)
+ set(S_VENEER_FILE "${CMAKE_CURRENT_BINARY_DIR}/s_veneers.o")
+endif()
+compiler_set_cmse_output(${PROJECT_NAME} "${S_VENEER_FILE}")
+
+#Configure what file shall be installed.
+#Set install location. Keep original value to avoid overriding command line
+#settings.
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Default install location for secure_fw." FORCE)
+endif()
+
+install(DIRECTORY ${TFM_ROOT_DIR}/interface/include/
+ DESTINATION tfm/inc)
+
+install(DIRECTORY ${TFM_ROOT_DIR}/interface/src/
+ DESTINATION tfm/src)
+
+install(FILES ${S_VENEER_FILE}
+ DESTINATION tfm/veneers)
+
+#Finally let cmake system apply changes after the whole project is defined.
+embedded_project_end(${PROJECT_NAME})
+
diff --git a/secure_fw/core/CMakeLists.inc b/secure_fw/core/CMakeLists.inc
new file mode 100644
index 0000000..0e17845
--- /dev/null
+++ b/secure_fw/core/CMakeLists.inc
@@ -0,0 +1,54 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "core" module.
+#This file assumes it will be included from a project specific cmakefile, and
+#will not create a library or executable.
+#Inputs:
+# TFM_ROOT_DIR - directory where secure FW sourec is located.
+#
+#Outputs:
+# Will modify include directories to make the source compile.
+# ALL_SRC_C: C source files to be compiled will be added to this list.
+# This shall be added to your add_executable or add_library command.
+# ALL_SRC_CXX: C++ source files to be compiled will be added to this list.
+# This shall be added to your add_executable or add_library command.
+# ALL_SRC_ASM: assembly source files to be compiled will be added to this
+# list. This shall be added to your add_executable or add_library
+# command.
+# Include directories will be modified by using the include_directories()
+# commands as needed.
+
+#Get the current directory where this file is located.
+set(SS_CORE_DIR ${CMAKE_CURRENT_LIST_DIR})
+if(NOT DEFINED TFM_ROOT_DIR)
+ message(FATAL_ERROR
+ "Please set TFM_ROOT_DIR before including this file.")
+endif()
+
+set (SS_CORE_C_SRC "${SS_CORE_DIR}/tfm_core.c"
+ "${SS_CORE_DIR}/tfm_handler.c"
+ "${SS_CORE_DIR}/tfm_secure_api.c"
+ "${SS_CORE_DIR}/tfm_unpriv_api.c"
+ )
+
+#Append all our source files to global lists.
+list(APPEND ALL_SRC_C ${SS_CORE_C_SRC})
+unset(SS_CORE_C_SRC)
+
+#Setting include directories
+embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
+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)
+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)
diff --git a/secure_fw/ns_callable/CMakeLists.inc b/secure_fw/ns_callable/CMakeLists.inc
new file mode 100644
index 0000000..25b6493
--- /dev/null
+++ b/secure_fw/ns_callable/CMakeLists.inc
@@ -0,0 +1,37 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "NS Callable" module.
+#This file assumes it will be included from a project specific cmakefile, and
+#will not create a library or executable.
+#Inputs:
+# TFM_ROOT_DIR - directory where secure FW source is located.
+#
+#Outputs:
+# Will modify include directories to make the source compile.
+# ALL_SRC_C: C source files to be compiled will be added to this list.
+# This shall be added to the add_executable or add_library command.
+# Include directories will be modified by using the include_directories() commands as needed.
+
+#Get the current directory where this file is located.
+set(SS_NS_CALLABLE_DIR ${CMAKE_CURRENT_LIST_DIR})
+if(NOT DEFINED TFM_ROOT_DIR)
+ message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
+endif()
+
+set (SS_NS_CALLABLE_C_SRC "${CMAKE_CURRENT_LIST_DIR}/tfm_sst_veneers.c")
+
+#Append all our source files to global lists.
+list(APPEND ALL_SRC_C ${SS_NS_CALLABLE_C_SRC})
+unset(SS_NS_CALLABLE_C_SRC)
+
+#Setting include directories
+embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
+
+
diff --git a/secure_fw/services/secure_storage/BuildMbedtls.cmake b/secure_fw/services/secure_storage/BuildMbedtls.cmake
new file mode 100644
index 0000000..891ada5
--- /dev/null
+++ b/secure_fw/services/secure_storage/BuildMbedtls.cmake
@@ -0,0 +1,76 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#When included, this file will add a target to build the mbedtls libraries with
+#the same compilation setting as used by the file including this one.
+cmake_minimum_required(VERSION 3.7)
+
+#Define where mbedtls intermediate output files are stored.
+set (MBEDTLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/mbedtls")
+
+#Check input variables
+if(NOT DEFINED MBEDTLS_BUILD_TYPE)
+ message(FATAL_ERROR "Please set MBEDTLS_BUILD_TYPE to 'Debug' or 'Release' before including this file.")
+endif()
+
+if(NOT DEFINED MBEDTLS_SOURCE_DIR)
+ message(FATAL_ERROR "Please set MBEDTLS_SOURCE_DIR before including this file.")
+endif()
+
+if(NOT DEFINED MBEDTLS_INSTALL_DIR)
+ message(FATAL_ERROR "Please set MBEDTLS_INSTALL_DIR before including this file.")
+endif()
+
+if(NOT DEFINED MBEDTLS_C_FLAGS)
+ message(FATAL_ERROR "Please set MBEDTLS_C_FLAGS before including this file.")
+endif()
+
+string(APPEND MBEDTLS_C_FLAGS ${CMAKE_C_FLAGS})
+if (NOT TARGET mbedtls_lib AND NOT TARGET mbedtls_lib_install)
+ #Build mbedtls as external project.
+ #This ensures mbedtls is built with exactly defined settings.
+ #mbedtls will be used from is't install location
+ include(ExternalProject)
+ # Add mbed TLS files to the build.
+ set(_static_lib_command ${CMAKE_C_CREATE_STATIC_LIBRARY})
+ externalproject_add(mbedtls_lib
+ SOURCE_DIR ${MBEDTLS_SOURCE_DIR}
+ #Set mbedtls features
+ CMAKE_ARGS -DENABLE_TESTING=OFF -DENABLE_PROGRAMS=OFF
+ #Enforce our build system's settings.
+ CMAKE_ARGS -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
+ #Inherit the build setting of this project
+ CMAKE_ARGS -DCMAKE_BUILD_TYPE=${MBEDTLS_BUILD_TYPE}
+ #C compiler settings
+ CMAKE_CACHE_ARGS -DCMAKE_C_COMPILER:string=${CMAKE_C_COMPILER}
+ CMAKE_CACHE_ARGS -DCMAKE_C_COMPILER_ID:string=${CMAKE_C_COMPILER_ID}
+ CMAKE_CACHE_ARGS -DCMAKE_C_FLAGS:string=${MBEDTLS_C_FLAGS}
+ CMAKE_CACHE_ARGS -DCMAKE_C_FLAGS_DEBUG:string=${CMAKE_C_FLAGS_DEBUG}
+ CMAKE_CACHE_ARGS -DCMAKE_C_FLAGS_RELEASE:string=${CMAKE_C_FLAGS_RELEASE}
+ CMAKE_CACHE_ARGS -DCMAKE_C_OUTPUT_EXTENSION:string=.o
+ CMAKE_CACHE_ARGS -DCMAKE_C_COMPILER_WORKS:bool=true
+ #Archiver settings
+ CMAKE_CACHE_ARGS -DCMAKE_AR:string=${CMAKE_AR}
+ CMAKE_CACHE_ARGS -DCMAKE_C_CREATE_STATIC_LIBRARY:internal=${_static_lib_command}
+ CMAKE_CACHE_ARGS -DCMAKE_C_LINK_EXECUTABLE:string=${CMAKE_C_LINK_EXECUTABLE}
+ CMAKE_CACHE_ARGS -DCMAKE_STATIC_LIBRARY_PREFIX_C:string=${CMAKE_STATIC_LIBRARY_PREFIX_C}
+ CMAKE_CACHE_ARGS -DCMAKE_STATIC_LIBRARY_PREFIX_CXX:string=${CMAKE_STATIC_LIBRARY_PREFIX_CXX}
+ #Install location
+ CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:string=${MBEDTLS_INSTALL_DIR}
+ #Place for intermediate build files
+ BINARY_DIR ${MBEDTLS_BINARY_DIR})
+
+ #Add an install target to force installation after each mbedtls build. Without
+ #this target installation happens only when a clean mbedtls build is executed.
+ add_custom_target(mbedtls_lib_install
+ COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/mbedtls -- install
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mbedtls
+ COMMENT "Installing mbedtls to ${MBEDTLS_INSTALL_DIR}"
+ VERBATIM)
+ #Make install rule depend on mbedtls library build
+ add_dependencies(mbedtls_lib_install mbedtls_lib)
+endif()
diff --git a/secure_fw/services/secure_storage/CMakeLists.inc b/secure_fw/services/secure_storage/CMakeLists.inc
new file mode 100644
index 0000000..4590df1
--- /dev/null
+++ b/secure_fw/services/secure_storage/CMakeLists.inc
@@ -0,0 +1,90 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "secure_storage" module.
+#This file assumes it will be included from a project specific cmakefile, and
+#will not create a library or executable.
+#Inputs:
+# MBEDTLS_INSTALL_DIR - directory where mbedtls headers and libraries can be found.
+# TFM_ROOT_DIR - root directory of the TF-M repository.
+#Outputs:
+# Will modify include directories to make the source compile.
+# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# Include directories will be modified by using the include_directories() commands as needed.
+
+#Get the current directory where this file is located.
+set(SECURE_STORAGE_DIR ${CMAKE_CURRENT_LIST_DIR})
+
+#Check input variables
+if (NOT DEFINED ENABLE_SECURE_STORAGE)
+ message(FATAL_ERROR "Incomplete build configuration: ENABLE_SECURE_STORAGE is undefined. ")
+endif()
+
+if (ENABLE_SECURE_STORAGE)
+ if (NOT DEFINED MBEDTLS_INSTALL_DIR)
+ message(FATAL_ERROR "Please set MBEDTLS_INSTALL_DIR before including this file.")
+ endif()
+
+ if (NOT DEFINED TFM_ROOT_DIR)
+ message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
+ endif()
+
+ if (NOT DEFINED SST_ENCRYPTION)
+ message(FATAL_ERROR "Incomplete build configuration: SST_ENCRYPTION is undefined. ")
+ endif()
+ if (NOT DEFINED SST_RAM_FS)
+ message(FATAL_ERROR "Incomplete build configuration: SST_RAM_FS is undefined. ")
+ endif()
+ if (NOT DEFINED SST_VALIDATE_METADATA_FROM_FLASH)
+ message(FATAL_ERROR "Incomplete build configuration: SST_VALIDATE_METADATA_FROM_FLASH is undefined. ")
+ endif()
+
+ set (SECURE_STORAGE_C_SRC "${SECURE_STORAGE_DIR}/sst_core.c"
+ "${SECURE_STORAGE_DIR}/sst_core_interface.c"
+ "${SECURE_STORAGE_DIR}/sst_asset_management.c"
+ "${SECURE_STORAGE_DIR}/sst_utils.c"
+ "${SECURE_STORAGE_DIR}/assets/sst_asset_defs.c"
+ "${SECURE_STORAGE_DIR}/flash/sst_flash_memory_mapped.c"
+ )
+
+ if(NOT SST_RAM_FS)
+ list(APPEND SECURE_STORAGE_C_SRC
+ "${SECURE_STORAGE_DIR}/flash/sst_flash_file_mapped.c")
+ endif()
+
+ if (SST_ENCRYPTION)
+ list (APPEND SECURE_STORAGE_C_SRC
+ "${SECURE_STORAGE_DIR}/crypto/sst_crypto_interface.c")
+ set_property(SOURCE ${SECURE_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS SST_ENCRYPTION)
+ endif()
+
+ if (SST_VALIDATE_METADATA_FROM_FLASH)
+ set_property(SOURCE ${SECURE_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS SST_VALIDATE_METADATA_FROM_FLASH)
+ endif()
+
+ if (SST_RAM_FS)
+ set_property(SOURCE ${SECURE_STORAGE_C_SRC} APPEND PROPERTY COMPILE_DEFINITIONS SST_RAM_FS)
+ endif()
+
+ #Append all our source files to global lists.
+ list(APPEND ALL_SRC_C ${SECURE_STORAGE_C_SRC})
+ unset(SECURE_STORAGE_C_SRC)
+
+ #Setting include directories
+ embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
+ embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
+ embedded_include_directories(PATH ${MBEDTLS_INSTALL_DIR} ABSOLUTE)
+ 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)
+ 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)
+endif()
diff --git a/secure_fw/services/secure_storage/CMakeLists.txt b/secure_fw/services/secure_storage/CMakeLists.txt
new file mode 100644
index 0000000..8a654f0
--- /dev/null
+++ b/secure_fw/services/secure_storage/CMakeLists.txt
@@ -0,0 +1,61 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_minimum_required(VERSION 3.7)
+
+# Tell cmake where our modules can be found
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../cmake)
+
+#Include common stuff to control cmake.
+include("Common/BuildSys")
+
+#Start an embedded project.
+embedded_project_start(CONFIG "${CMAKE_CURRENT_LIST_DIR}/../../../ConfigDefault.cmake")
+project(tfm_storage LANGUAGES ASM C)
+embedded_project_fixup()
+
+###Some project global settings
+set (SECURE_STORAGE_DIR "${CMAKE_CURRENT_LIST_DIR}")
+get_filename_component(TFM_ROOT_DIR "${SECURE_STORAGE_DIR}/../../.." ABSOLUTE)
+#Define location of mbedtls source, build, and installation directory.
+get_filename_component(MBEDTLS_SOURCE_DIR "${TFM_ROOT_DIR}/../mbedtls" ABSOLUTE)
+set (MBEDTLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/mbedtls")
+set (MBEDTLS_INSTALL_DIR ${MBEDTLS_BINARY_DIR}/mbedtls_install)
+
+###Get the definition of what files we need to build
+set (ENABLE_SECURE_STORAGE ON)
+include(CMakeLists.inc)
+
+
+###Configure how we build our target
+if(DEFINED CORE_TEST)
+ set (TFM_LVL 3)
+else()
+ set (TFM_LVL 1)
+endif()
+
+#Set build type for mbedtls libraries
+if (MBEDTLS_DEBUG)
+ set(MBEDTLS_BUILD_TYPE "Debug")
+else()
+ set(MBEDTLS_BUILD_TYPE "Release")
+endif()
+
+#Build mbedtls as external project.
+#This ensures mbedtls is built with exactly defined settings.
+#mbedtls will be used from is't install location
+include(BuildMbedtls.cmake)
+
+# Specify what we build (for the secure storage service, build as a static library)
+add_library(tfm_storage STATIC ${ALL_SRC_ASM} ${ALL_SRC_C})
+embedded_set_target_compile_defines(TARGET tfm_storage LANGUAGE C DEFINES __ARM_FEATURE_CMSE=3 __thumb2__ TFM_LVL=${TFM_LVL})
+#Add a dependency on the mbed_tls_lib_install target.
+add_dependencies(tfm_storage mbedtls_lib_install)
+#Ask the compiler to merge the mbedtls and the secure storage libraries.
+compiler_merge_library(DEST tfm_storage LIBS "${MBEDTLS_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX_C}mbedcrypto${CMAKE_STATIC_LIBRARY_SUFFIX_C}")
+
+embedded_project_end(tfm_storage)
diff --git a/secure_fw/spm/CMakeLists.inc b/secure_fw/spm/CMakeLists.inc
new file mode 100644
index 0000000..1808f66
--- /dev/null
+++ b/secure_fw/spm/CMakeLists.inc
@@ -0,0 +1,46 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "spm" module.
+#This file assumes it will be included from a project specific cmakefile, and
+#will not create a library or executable.
+#Inputs:
+# TFM_ROOT_DIR - root directory of the TF-M repository.
+#
+#Outputs:
+# Will modify include directories to make the source compile.
+# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# Include directories will be modified by using the include_directories() commands as needed.
+
+#Get the current directory where this file is located.
+set(SS_SPM_DIR ${CMAKE_CURRENT_LIST_DIR})
+if(NOT DEFINED TFM_ROOT_DIR)
+ message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
+endif()
+
+set (SS_SPM_C_SRC "${SS_SPM_DIR}/mpu_armv8m_drv.c"
+ "${SS_SPM_DIR}/spm_api.c"
+ )
+
+
+#Append all our source files to global lists.
+list(APPEND ALL_SRC_C ${SS_SPM_C_SRC})
+unset(SS_SPM_C_SRC)
+
+#Setting include directories
+embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
+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)
+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)
diff --git a/test/CMakeLists.inc b/test/CMakeLists.inc
new file mode 100644
index 0000000..694ab75
--- /dev/null
+++ b/test/CMakeLists.inc
@@ -0,0 +1,33 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "test" module.
+#This file assumes it will be included from a project specific cmakefile, and
+#will not create a library or executable.
+#Inputs:
+# TFM_ROOT_DIR - root directory of the TF-M repo.
+#
+#Outputs:
+# Will modify include directories to make the source compile.
+# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# Include directories will be modified by using the include_directories() commands as needed.
+
+#Get the current directory where this file is located.
+if(NOT DEFINED TFM_ROOT_DIR)
+ message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
+endif()
+
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/core ABSOLUTE)
+# add the framework
+include(${CMAKE_CURRENT_LIST_DIR}/framework/CMakeLists.inc)
+include(${CMAKE_CURRENT_LIST_DIR}/suites/core/CMakeLists.inc)
+include(${CMAKE_CURRENT_LIST_DIR}/suites/invert/CMakeLists.inc)
+include(${CMAKE_CURRENT_LIST_DIR}/suites/sst/CMakeLists.inc)
+include(${CMAKE_CURRENT_LIST_DIR}/test_services/CMakeLists.inc)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..2779982
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,81 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_minimum_required(VERSION 3.7)
+
+#Tell cmake where our modules can be found
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake)
+
+#Include common stuff to control cmake.
+include("Common/BuildSys")
+
+#Start an embedded project.
+embedded_project_start(CONFIG "${CMAKE_CURRENT_LIST_DIR}/../ConfigDefault.cmake")
+project(tfm_tests LANGUAGES ASM C)
+embedded_project_fixup()
+
+get_filename_component(TFM_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
+
+#Check incoming configuration options
+if (NOT DEFINED SERVICES_TEST_ENABLED)
+ message(FATAL_ERROR "Incomplete build configuration: SERVICES_TEST_ENABLED is undefined. ")
+endif()
+
+if (NOT DEFINED CORE_TEST)
+ message(FATAL_ERROR "Incomplete build configuration: CORE_TEST is undefined. ")
+endif()
+
+if(CORE_TEST)
+ set (TFM_LVL 3)
+else()
+ set (TFM_LVL 1)
+endif()
+
+#Configure our options as needed.
+if (CORE_TEST_INTERACTIVE OR CORE_TEST_POSITIVE)
+ set(ENABLE_CORE_TESTS True)
+ set(ENABLE_CORE_TESTS_2 True)
+else()
+ set(ENABLE_CORE_TESTS False)
+ set(ENABLE_CORE_TESTS_2 False)
+endif()
+
+if (NOT DEFINED CMSIS_5_DIR)
+ set(CMSIS_5_DIR ${TFM_ROOT_DIR}/../CMSIS_5)
+endif()
+set(ENABLE_SECURE_STORAGE_SERVICE_TESTS TRUE)
+set(ENABLE_INVERT_SERVICE_TESTS TRUE)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeLists.inc)
+
+#Build the secure library
+add_library(tfm_secure_tests STATIC ${ALL_SRC_C} ${ALL_SRC_C_S})
+embedded_set_target_compile_defines(TARGET tfm_secure_tests LANGUAGE C DEFINES __thumb2__ __ARM_FEATURE_CMSE=3 TFM_LVL=${TFM_LVL} APPEND)
+
+
+#Build the non-secure library
+set(CMAKE_STATIC_LIBRARY_PREFIX_C "lib")
+add_library(tfm_non_secure_tests STATIC ${ALL_SRC_C} ${ALL_SRC_C_NS})
+embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES __thumb2__ __ARM_FEATURE_CMSE=3 __DOMAIN_NS=1 APPEND)
+#__DOMAIN_NS=1
+
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Default install location for tfm_storage." FORCE)
+endif()
+
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/framework/integ_test.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/suites/core/non_secure/svc_core_test_ns.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/suites/sst/non_secure/os_wrapper.h
+ DESTINATION tfm/test/inc)
+
+install(TARGETS tfm_non_secure_tests
+ DESTINATION tfm/test/lib
+ PUBLIC_HEADER DESTINATION tfm/test/inc)
+
+
+embedded_project_end(tfm_non_secure_tests)
+embedded_project_end(tfm_secure_tests)
+
diff --git a/test/framework/CMakeLists.inc b/test/framework/CMakeLists.inc
new file mode 100644
index 0000000..0f22dbc
--- /dev/null
+++ b/test/framework/CMakeLists.inc
@@ -0,0 +1,46 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "test framework" module.
+#This file assumes it will be included from a project specific cmakefile, and
+#will not create a library or executable.
+#Inputs:
+# TFM_ROOT_DIR - root directory of the TF-M repo.
+#
+#Outputs:
+# Will modify include directories to make the source compile.
+# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# Include directories will be modified by using the include_directories() commands as needed.
+
+#Get the current directory where this file is located.
+set(TEST_FRAMEWORK_DIR ${CMAKE_CURRENT_LIST_DIR})
+if(NOT DEFINED TFM_ROOT_DIR)
+ message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
+endif()
+
+set (TEST_FRAMEWORK_C_SRC "${TEST_FRAMEWORK_DIR}/helpers.c"
+ "${TEST_FRAMEWORK_DIR}/integ_test_helper.c"
+ "${TEST_FRAMEWORK_DIR}/test_framework.c"
+ )
+
+set (TEST_FRAMEWORK_C_SRC_NS "${TEST_FRAMEWORK_DIR}/non_secure_suites.c"
+ )
+
+set (TEST_FRAMEWORK_C_SRC_S "${TEST_FRAMEWORK_DIR}/secure_suites.c"
+ )
+
+#Append all our source files to global lists.
+list(APPEND ALL_SRC_C ${TEST_FRAMEWORK_C_SRC})
+list(APPEND ALL_SRC_C_S ${TEST_FRAMEWORK_C_SRC_S})
+list(APPEND ALL_SRC_C_NS ${TEST_FRAMEWORK_C_SRC_NS})
+
+#Setting include directories
+embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
+
diff --git a/test/suites/core/CMakeLists.inc b/test/suites/core/CMakeLists.inc
new file mode 100644
index 0000000..4c516d1
--- /dev/null
+++ b/test/suites/core/CMakeLists.inc
@@ -0,0 +1,49 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "core test" module.
+#This file assumes it will be included from a project specific cmakefile, and
+#will not create a library or executable.
+#Inputs:
+# TFM_ROOT_DIR - root directory of the TF-M repo.
+#
+#Outputs:
+# Will modify include directories to make the source compile.
+# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# Include directories will be modified by using the include_directories() commands as needed.
+
+#Get the current directory where this file is located.
+set(CORE_TEST_DIR ${CMAKE_CURRENT_LIST_DIR})
+if(NOT DEFINED TFM_ROOT_DIR)
+ message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
+endif()
+
+if (NOT DEFINED CORE_TEST_SERVICES)
+ message(FATAL_ERROR "Incomplete build configuration: CORE_TEST is undefined. ")
+elseif (CORE_TEST_SERVICES)
+ list(APPEND ALL_SRC_C_NS "${CORE_TEST_DIR}/non_secure/core_test_api.c"
+ "${CORE_TEST_DIR}/non_secure/svc_core_test_ns.c")
+endif()
+
+if (NOT DEFINED CORE_TEST_POSITIVE)
+ message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_POSITIVE is undefined. ")
+elseif (CORE_TEST_POSITIVE)
+ list(APPEND ALL_SRC_C_NS "${CORE_TEST_DIR}/non_secure/core_ns_positive_testsuite.c")
+endif()
+
+if (NOT DEFINED CORE_TEST_INTERACTIVE)
+ message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_INTERACTIVE is undefined. ")
+elseif (CORE_TEST_INTERACTIVE)
+ list(APPEND ALL_SRC_C_NS "${CORE_TEST_DIR}/non_secure/core_ns_interactive_testsuite.c")
+endif()
+
+#Setting include directories
+embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
+
diff --git a/test/suites/invert/CMakeLists.inc b/test/suites/invert/CMakeLists.inc
new file mode 100644
index 0000000..1fc55af
--- /dev/null
+++ b/test/suites/invert/CMakeLists.inc
@@ -0,0 +1,36 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "secure invert test" module.
+#This file assumes it will be included from a project specific cmakefile, and
+#will not create a library or executable.
+#Inputs:
+# TFM_ROOT_DIR - root directory of the TF-M repo.
+#
+#Outputs:
+# Will modify include directories to make the source compile.
+# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# Include directories will be modified by using the include_directories() commands as needed.
+
+#Get the current directory where this file is located.
+set(SECURE_INVERT_TEST_DIR ${CMAKE_CURRENT_LIST_DIR})
+if(NOT DEFINED TFM_ROOT_DIR)
+ message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
+endif()
+
+if (NOT DEFINED ENABLE_INVERT_SERVICE_TESTS)
+ message(FATAL_ERROR "Incomplete build configuration: ENABLE_INVERT_SERVICE_TESTS is undefined. ")
+elseif(ENABLE_INVERT_SERVICE_TESTS)
+ list(APPEND ALL_SRC_C_S "${SECURE_INVERT_TEST_DIR}/secure/invert_s_interface_testsuite.c")
+ list(APPEND ALL_SRC_C_NS "${SECURE_INVERT_TEST_DIR}/non_secure/invert_ns_interface_testsuite.c")
+
+ #Setting include directories
+ embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
+ embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
+endif()
diff --git a/test/suites/sst/CMakeLists.inc b/test/suites/sst/CMakeLists.inc
new file mode 100644
index 0000000..125649d
--- /dev/null
+++ b/test/suites/sst/CMakeLists.inc
@@ -0,0 +1,49 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "secure storage test" module.
+#This file assumes it will be included from a project specific cmakefile, and
+#will not create a library or executable.
+#Inputs:
+# TFM_ROOT_DIR - root directory of the TF-M repo.
+#
+#Outputs:
+# Will modify include directories to make the source compile.
+# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# Include directories will be modified by using the include_directories() commands as needed.
+
+#Get the current directory where this file is located.
+set(SECURE_STORAGE_TEST_DIR ${CMAKE_CURRENT_LIST_DIR})
+if(NOT DEFINED TFM_ROOT_DIR)
+ message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
+endif()
+
+if(NOT DEFINED CMSIS_5_DIR)
+ message(FATAL_ERROR "Please set CMSIS_5_DIR before including this file.")
+endif()
+
+if (NOT DEFINED ENABLE_SECURE_STORAGE_SERVICE_TESTS)
+ message(FATAL_ERROR "Incomplete build configuration: ENABLE_SECURE_STORAGE_SERVICE_TESTS is undefined. ")
+elseif (ENABLE_SECURE_STORAGE_SERVICE_TESTS)
+ list(APPEND ALL_SRC_C_S "${SECURE_STORAGE_TEST_DIR}/secure/s_test_helpers.c"
+ "${SECURE_STORAGE_TEST_DIR}/secure/sst_sec_interface_testsuite.c"
+ "${SECURE_STORAGE_TEST_DIR}/secure/sst_reliability_testsuite.c"
+ "${SECURE_STORAGE_TEST_DIR}/secure/sst_policy_testsuite.c"
+ )
+
+ list(APPEND ALL_SRC_C_NS "${SECURE_STORAGE_TEST_DIR}/non_secure/sst_ns_interface_testsuite.c")
+
+ #Setting include directories
+ embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
+ embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
+
+ embedded_include_directories(PATH ${CMSIS_5_DIR}/CMSIS/RTOS2/RTX/Include ABSOLUTE)
+ embedded_include_directories(PATH ${CMSIS_5_DIR}/CMSIS/RTOS2/Include ABSOLUTE)
+ embedded_include_directories(PATH ${CMSIS_5_DIR}/CMSIS/RTOS2/RTX/Config ABSOLUTE)
+endif()
diff --git a/test/test_services/CMakeLists.inc b/test/test_services/CMakeLists.inc
new file mode 100644
index 0000000..c5b57bd
--- /dev/null
+++ b/test/test_services/CMakeLists.inc
@@ -0,0 +1,54 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "secure services" module.
+#This file assumes it will be included from a project specific cmakefile, and
+#will not create a library or executable.
+#Inputs:
+# TFM_ROOT_DIR - root directory of the TF-M repository.
+#
+#Outputs:
+# Will modify include directories to make the source compile.
+# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# Include directories will be modified by using the include_directories() commands as needed.
+
+#Get the current directory where this file is located.
+set(CORE_TEST_DIR ${CMAKE_CURRENT_LIST_DIR})
+
+#Check input variables
+if (NOT DEFINED TFM_ROOT_DIR)
+ message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
+endif()
+
+if (NOT DEFINED ENABLE_CORE_TESTS)
+ message(FATAL_ERROR "Incomplete build configuration: ENABLE_CORE_TESTS is undefined. ")
+elseif(ENABLE_CORE_TESTS)
+ list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_core_test/tfm_ss_core_test.c"
+ "${CORE_TEST_DIR}/tfm_core_test/tfm_ss_core_test_veneers.c"
+ )
+endif()
+
+if (NOT DEFINED ENABLE_CORE_TESTS_2)
+ message(FATAL_ERROR "Incomplete build configuration: ENABLE_CORE_TESTS_2 is undefined. ")
+elseif(ENABLE_CORE_TESTS_2)
+ list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_core_test_2/tfm_ss_core_test_2_veneers.c"
+ "${CORE_TEST_DIR}/tfm_core_test_2/tfm_ss_core_test_2.c"
+ )
+endif()
+
+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)
+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/mps2/mps2_board" ABSOLUTE)
+
+