blob: 2ffe11507eb97d53a6a3b2f436d07523f1d9b736 [file] [log] [blame]
Mate Toth-Pal65c935e2018-01-17 18:42:13 +01001#-------------------------------------------------------------------------------
2# Copyright (c) 2018, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8if(NOT DEFINED REGRESSION)
9 message(FATAL_ERROR "ERROR: Incomplete Configuration: REGRESSION not defined, Include this file from a Config*.cmake")
10elseif(NOT DEFINED CORE_TEST)
11 message(FATAL_ERROR "ERROR: Incomplete Configuration: CORE_TEST not defined, Include this file from a Config*.cmake")
12elseif(NOT DEFINED BL2)
13 message(FATAL_ERROR "ERROR: Incomplete Configuration: BL2 not defined, Include this file from a Config*.cmake")
14endif()
15
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +010016set(BUILD_CMSIS_CORE Off)
17set(BUILD_RETARGET Off)
18set(BUILD_NATIVE_DRIVERS Off)
19set(BUILD_TIME Off)
20set(BUILD_STARTUP Off)
21set(BUILD_TARGET_CFG Off)
22set(BUILD_TARGET_HARDWARE_KEYS Off)
23set(BUILD_CMSIS_DRIVERS Off)
24set(BUILD_UART_STDOUT Off)
25set(BUILD_FLASH Off)
26if(NOT DEFINED PLATFORM_CMAKE_FILE)
27 message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.")
28elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE})
29 message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.")
30else()
31 include(${PLATFORM_CMAKE_FILE})
32endif()
33
34
35#Use any ARMCLANG version found on PATH. Note: Only versions supported by the
36#build system will work. A file cmake/Common/CompilerArmClangXY.cmake
37#must be present with a matching version.
38include("Common/FindArmClang")
39include("Common/${ARMCLANG_MODULE}")
40
Mate Toth-Pal65c935e2018-01-17 18:42:13 +010041##Shared compiler and linker settings.
42function(config_setting_shared_flags tgt)
43 embedded_set_target_compile_flags(TARGET ${tgt} LANGUAGE C FLAGS -xc -std=c99 -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse -Wall -Werror)
44 embedded_set_target_link_flags(TARGET ${tgt} FLAGS --strict --map --symbols --xref --entry=Reset_Handler --info=summarysizes,sizes,totals,unused,veneers)
45endfunction()
46
47#Settings which shall be set for all projects the same way based
48# on the variables above.
Mate Toth-Pal349714a2018-02-23 15:30:24 +010049set (TFM_PARTITION_TEST_CORE OFF)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +010050set (CORE_TEST_POSITIVE OFF)
51set (CORE_TEST_INTERACTIVE OFF)
Mate Toth-Pal349714a2018-02-23 15:30:24 +010052set (TFM_PARTITION_TEST_SST OFF)
Miklos Balintf13ec022018-04-06 17:21:22 +020053set (REFERENCE_PLATFORM OFF)
54
55if(${TARGET_PLATFORM} STREQUAL "AN521" OR ${TARGET_PLATFORM} STREQUAL "AN519")
56 set (REFERENCE_PLATFORM ON)
57endif()
Mate Toth-Pal65c935e2018-01-17 18:42:13 +010058
59if (REGRESSION)
60 set(SERVICES_TEST_ENABLED ON)
61else()
62 set(SERVICES_TEST_ENABLED OFF)
63endif()
64
65if (SERVICES_TEST_ENABLED)
66 set(SERVICE_TEST_S ON)
67 set(SERVICE_TEST_NS ON)
Miklos Balintf13ec022018-04-06 17:21:22 +020068 if (REFERENCE_PLATFORM)
69 set(CORE_TEST_POSITIVE ON)
70 endif()
Mate Toth-Pal65c935e2018-01-17 18:42:13 +010071endif()
72
73if (CORE_TEST)
74 set(CORE_TEST_POSITIVE ON)
75 set(CORE_TEST_INTERACTIVE OFF)
76endif()
77
78if(CORE_TEST_INTERACTIVE)
79 add_definitions(-DCORE_TEST_INTERACTIVE)
80 set(TEST_FRAMEWORK_NS ON)
Mate Toth-Pal349714a2018-02-23 15:30:24 +010081 set(TFM_PARTITION_TEST_CORE ON)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +010082endif()
83
84if(CORE_TEST_POSITIVE)
85 add_definitions(-DCORE_TEST_POSITIVE)
86 set(TEST_FRAMEWORK_NS ON)
Mate Toth-Pal349714a2018-02-23 15:30:24 +010087 set(TFM_PARTITION_TEST_CORE ON)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +010088endif()
89
90if (SERVICE_TEST_S)
91 add_definitions(-DSERVICES_TEST_S)
92 set(TEST_FRAMEWORK_S ON)
93endif()
94
95if (SERVICE_TEST_NS)
96 add_definitions(-DSERVICES_TEST_NS)
97 set(TEST_FRAMEWORK_NS ON)
Mate Toth-Pal349714a2018-02-23 15:30:24 +010098 set(TFM_PARTITION_TEST_SST ON)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +010099endif()
100
101if(TEST_FRAMEWORK_S)
102 add_definitions(-DTEST_FRAMEWORK_S)
103endif()
104
105if(TEST_FRAMEWORK_NS)
106 add_definitions(-DTEST_FRAMEWORK_NS)
107endif()
108
Mate Toth-Pal349714a2018-02-23 15:30:24 +0100109if (TFM_PARTITION_TEST_CORE)
110 add_definitions(-DTFM_PARTITION_TEST_CORE)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100111endif()
112
Mate Toth-Pal349714a2018-02-23 15:30:24 +0100113if (TFM_PARTITION_TEST_SST)
114 add_definitions(-DTFM_PARTITION_TEST_SST)
Jamie Fox5592db02017-12-18 16:48:29 +0000115endif()
116
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100117if (BL2)
118 add_definitions(-DBL2)
119endif()
120
121##Secure side
122config_setting_shared_flags(tfm_s)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100123
124##Non secure side
125config_setting_shared_flags(tfm_ns)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100126
127##TF-M storage
128config_setting_shared_flags(tfm_storage)
Marc Moreno Berengue44af9272018-01-25 17:18:00 +0000129set(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/common")
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100130
131set (SST_ENCRYPTION ON)
132set (SST_RAM_FS ON)
133set (SST_VALIDATE_METADATA_FROM_FLASH ON)
134set (ENABLE_SECURE_STORAGE ON)
135set (MBEDTLS_DEBUG ON)
136
137##Tests
138config_setting_shared_flags(tfm_secure_tests)
139config_setting_shared_flags(tfm_non_secure_tests)
140
141##BL2
142config_setting_shared_flags(mcuboot)
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +0000143set(MBEDTLS_C_FLAGS_BL2 "-D__ARM_FEATURE_CMSE=3 -D__thumb2__ -fshort-enums -mfpu=none -fshort-wchar -funsigned-char -mcmse -DMBEDTLS_CONFIG_FILE=\\\\\\\"config-boot.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/bl2/ext/mcuboot/include")