blob: 9a45b5ad1a6c7bd8b9244fde0f7cf516a8b2f78d [file] [log] [blame]
Mate Toth-Pal65c935e2018-01-17 18:42:13 +01001#-------------------------------------------------------------------------------
Jamie Fox17c30bb2019-01-10 13:39:33 +00002# Copyright (c) 2018-2019, Arm Limited. All rights reserved.
Mate Toth-Pal65c935e2018-01-17 18:42:13 +01003#
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")
Tamas Band90c81b2018-08-15 15:03:42 +010012elseif(NOT DEFINED TFM_LVL)
13 message(FATAL_ERROR "ERROR: Incomplete Configuration: TFM_LVL not defined, Include this file from a Config*.cmake")
David Huf2cfa122019-08-27 15:32:38 +080014elseif(NOT DEFINED CORE_IPC)
15 message(FATAL_ERROR "ERROR: Incomplete Configuration: CORE_IPC not deinfed. Include this file from a Config*.cmake")
Mate Toth-Pal65c935e2018-01-17 18:42:13 +010016endif()
17
Mate Toth-Palee551bc2018-06-12 16:40:45 +020018if(NOT DEFINED COMPILER)
19 message(FATAL_ERROR "ERROR: COMPILER is not set in command line")
20elseif((NOT ${COMPILER} STREQUAL "ARMCLANG") AND (NOT ${COMPILER} STREQUAL "GNUARM"))
21 message(FATAL_ERROR "ERROR: Compiler \"${COMPILER}\" is not supported.")
22endif()
23
Tamas Bandd10fe52019-09-18 11:52:32 +010024#Configure the default build type
25set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (i.e. Debug)")
26
Raef Colesb321c0b2019-10-15 08:49:17 +010027#Ignore case on the cmake build types
28string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
29
Edison Aicb0ecf62019-07-10 18:43:51 +080030if(CORE_IPC)
31 if (TFM_LVL EQUAL 3)
32 message(FATAL_ERROR "ERROR: Invalid isolation level!")
33 endif()
34else()
35 if(NOT TFM_LVL EQUAL 1)
36 message(FATAL_ERROR "ERROR: Invalid isolation level!")
37 endif()
38endif()
39
David Vincze4638b2a2019-05-24 10:14:23 +020040#BL2 bootloader (MCUBoot) related settings
David Vincze54d05552019-08-05 12:58:47 +020041include(${CMAKE_CURRENT_LIST_DIR}/bl2/ext/mcuboot/MCUBootConfig.cmake)
David Vincze4638b2a2019-05-24 10:14:23 +020042
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +010043set(BUILD_CMSIS_CORE Off)
44set(BUILD_RETARGET Off)
45set(BUILD_NATIVE_DRIVERS Off)
46set(BUILD_TIME Off)
47set(BUILD_STARTUP Off)
48set(BUILD_TARGET_CFG Off)
49set(BUILD_TARGET_HARDWARE_KEYS Off)
Marc Moreno Berengue4cc81fc2018-08-10 14:32:01 +010050set(BUILD_TARGET_NV_COUNTERS Off)
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +010051set(BUILD_CMSIS_DRIVERS Off)
52set(BUILD_UART_STDOUT Off)
53set(BUILD_FLASH Off)
Tamas Ban3681ce02018-11-22 15:19:24 +000054set(BUILD_BOOT_SEED Off)
Tamas Ban38e17312018-11-22 15:26:35 +000055set(BUILD_DEVICE_ID Off)
Mate Toth-Pald3c77662019-02-20 16:23:00 +010056set(BUILD_PLAT_TEST Off)
Tamas Band4bf3472019-09-06 12:59:56 +010057set(BUILD_BOOT_HAL Off)
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +010058if(NOT DEFINED PLATFORM_CMAKE_FILE)
59 message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.")
60elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE})
61 message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.")
62else()
63 include(${PLATFORM_CMAKE_FILE})
64endif()
65
David Hu857bfa52019-05-21 13:54:50 +080066# Select the corresponding CPU type and configuration according to current
67# building status in multi-core scenario.
68# The updated configuration will be used in following compiler setting.
69if (DEFINED TFM_MULTI_CORE_TOPOLOGY AND TFM_MULTI_CORE_TOPOLOGY)
David Hu104388f2019-11-18 14:37:32 +080070 if (NOT CORE_IPC)
71 message(FATAL_ERROR "CORE_IPC is OFF. Multi-core topology should work in IPC model.")
72 endif()
73
David Hu857bfa52019-05-21 13:54:50 +080074 include("Common/MultiCore")
75
76 if (NOT DEFINED TFM_BUILD_IN_SPE)
77 message(FATAL_ERROR "Flag of building in SPE is not specified. Please set TFM_BUILD_IN_SPE.")
78 else()
79 select_arm_cpu_type(${TFM_BUILD_IN_SPE})
80 endif()
David Hu857bfa52019-05-21 13:54:50 +080081
David Hufeae0f92019-06-17 13:42:20 +080082 # CMSE is unnecessary in multi-core scenarios.
83 # TODO: Need further discussion about if CMSE is required when an Armv8-M
84 # core acts as secure core in multi-core scenario.
85 set (CMSE_FLAGS "")
86 set (ARM_FEATURE_CMSE 0)
87else()
88 set (CMSE_FLAGS "-mcmse")
89 set (ARM_FEATURE_CMSE 3)
90endif()
91
Mate Toth-Palee551bc2018-06-12 16:40:45 +020092if(${COMPILER} STREQUAL "ARMCLANG")
Mate Toth-Pal76867262018-03-09 13:15:36 +010093 #Use any ARMCLANG version found on PATH. Note: Only versions supported by the
94 #build system will work. A file cmake/Common/CompilerArmClangXY.cmake
95 #must be present with a matching version.
96 include("Common/FindArmClang")
97 include("Common/${ARMCLANG_MODULE}")
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +010098
David Hufeae0f92019-06-17 13:42:20 +080099 set (COMMON_COMPILE_FLAGS -fshort-enums -fshort-wchar -funsigned-char -mfpu=none ${CMSE_FLAGS} -ffunction-sections -fdata-sections)
Tamas Bandb69d522018-03-01 10:04:41 +0000100 ##Shared compiler settings.
101 function(config_setting_shared_compiler_flags tgt)
Mate Toth-Pal76867262018-03-09 13:15:36 +0100102 embedded_set_target_compile_flags(TARGET ${tgt} LANGUAGE C FLAGS -xc -std=c99 ${COMMON_COMPILE_FLAGS} -Wall -Werror)
Tamas Bandb69d522018-03-01 10:04:41 +0000103 endfunction()
104
105 ##Shared linker settings.
106 function(config_setting_shared_linker_flags tgt)
Antonio de Angelis3302f452019-07-19 10:36:33 +0100107 embedded_set_target_link_flags(TARGET ${tgt} FLAGS --strict --map --symbols --xref --entry=Reset_Handler --remove --info=summarysizes,sizes,totals,unused,veneers)
Mate Toth-Pal76867262018-03-09 13:15:36 +0100108 endfunction()
109elseif(${COMPILER} STREQUAL "GNUARM")
110 #Use any GNUARM version found on PATH. Note: Only versions supported by the
111 #build system will work. A file cmake/Common/CompilerGNUARMXY.cmake
112 #must be present with a matching version.
113 include("Common/FindGNUARM")
114 include("Common/${GNUARM_MODULE}")
Mate Toth-Pal48fc6a02018-01-24 09:50:14 +0100115
David Hufeae0f92019-06-17 13:42:20 +0800116 set (COMMON_COMPILE_FLAGS -fshort-enums -fshort-wchar -funsigned-char -msoft-float ${CMSE_FLAGS} -ffunction-sections -fdata-sections --specs=nano.specs)
Mate Toth-Pal76867262018-03-09 13:15:36 +0100117 ##Shared compiler and linker settings.
Tamas Bandb69d522018-03-01 10:04:41 +0000118 function(config_setting_shared_compiler_flags tgt)
Mate Toth-Pal76867262018-03-09 13:15:36 +0100119 embedded_set_target_compile_flags(TARGET ${tgt} LANGUAGE C FLAGS -xc -std=c99 ${COMMON_COMPILE_FLAGS} -Wall -Werror -Wno-format -Wno-return-type -Wno-unused-but-set-variable)
Tamas Bandb69d522018-03-01 10:04:41 +0000120 endfunction()
121
122 ##Shared linker settings.
123 function(config_setting_shared_linker_flags tgt)
Mate Toth-Pal76867262018-03-09 13:15:36 +0100124 #--no-wchar-size-warning flag is added because TF-M sources are compiled
125 #with short wchars, however the standard library is compiled with normal
126 #wchar, and this generates linker time warnings. TF-M code does not use
127 #wchar, so the warning can be suppressed.
Antonio de Angelis3302f452019-07-19 10:36:33 +0100128 embedded_set_target_link_flags(TARGET ${tgt} FLAGS -Wl,-check-sections,-fatal-warnings,--gc-sections,--no-wchar-size-warning,--print-memory-usage --entry=Reset_Handler --specs=nano.specs)
Mate Toth-Pal76867262018-03-09 13:15:36 +0100129 endfunction()
Mate Toth-Pal76867262018-03-09 13:15:36 +0100130endif()
131
132#Create a string from the compile flags list, so that it can be used later
133#in this file to set mbedtls and BL2 flags
Tamas Bandb69d522018-03-01 10:04:41 +0000134list_to_string(COMMON_COMPILE_FLAGS_STR ${COMMON_COMPILE_FLAGS})
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100135
136#Settings which shall be set for all projects the same way based
137# on the variables above.
Mate Toth-Pal349714a2018-02-23 15:30:24 +0100138set (TFM_PARTITION_TEST_CORE OFF)
Jamie Foxadf02552019-05-16 17:44:52 +0100139set (TFM_PARTITION_TEST_CORE_IPC OFF)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100140set (CORE_TEST_POSITIVE OFF)
141set (CORE_TEST_INTERACTIVE OFF)
Miklos Balintf13ec022018-04-06 17:21:22 +0200142set (REFERENCE_PLATFORM OFF)
Ben Davis6d7256b2018-04-18 14:16:53 +0100143set (TFM_PARTITION_TEST_SECURE_SERVICES OFF)
Jamie Fox0e823a02019-10-28 17:28:19 +0000144set (TFM_PARTITION_TEST_SST OFF)
Tamas Band90c81b2018-08-15 15:03:42 +0100145set (SERVICES_TEST_ENABLED OFF)
Marc Moreno Berenguecae2c532018-10-09 12:58:46 +0100146set (TEST_FRAMEWORK_S OFF)
147set (TEST_FRAMEWORK_NS OFF)
Edison Aiec109cd2018-07-17 16:04:14 +0800148set (TFM_PSA_API OFF)
Miklos Balint87da2512018-04-19 13:45:50 +0200149set (TFM_LEGACY_API ON)
Miklos Balintf13ec022018-04-06 17:21:22 +0200150
Jamie Foxc78c62c2019-05-23 13:42:17 +0100151option(TFM_PARTITION_AUDIT_LOG "Enable the TF-M Audit Log partition" ON)
Mingyang Sun9511e5e2019-05-29 18:18:44 +0800152option(TFM_PARTITION_PLATFORM "Enable the TF-M Platform partition" ON)
Jamie Foxc78c62c2019-05-23 13:42:17 +0100153
Marton Berke6fd21f12019-07-02 13:43:07 +0200154if(${TARGET_PLATFORM} STREQUAL "AN521" OR ${TARGET_PLATFORM} STREQUAL "AN519" OR ${TARGET_PLATFORM} STREQUAL "AN539")
Miklos Balintf13ec022018-04-06 17:21:22 +0200155 set (REFERENCE_PLATFORM ON)
156endif()
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100157
Miklos Balint6cbeba62018-04-12 17:31:34 +0200158# Option to demonstrate usage of secure-only peripheral
159set (SECURE_UART1 OFF)
160
Alan DeMars61844692019-10-22 08:23:29 -0700161if (PLATFORM_SVC_HANDLERS)
162 add_definitions(-DPLATFORM_SVC_HANDLERS)
163endif()
164
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100165if (REGRESSION)
166 set(SERVICES_TEST_ENABLED ON)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100167endif()
168
Edison Aiec109cd2018-07-17 16:04:14 +0800169if (CORE_IPC)
170 set(TFM_PSA_API ON)
David Huf2cfa122019-08-27 15:32:38 +0800171
172 # Disable IPC Test by default if the config or platform doesn't explicitly
173 # require it
174 if (NOT DEFINED IPC_TEST)
175 set(IPC_TEST OFF)
176 endif()
177else()
178 set(IPC_TEST OFF)
Edison Aiec109cd2018-07-17 16:04:14 +0800179endif()
180
Miklos Balint87da2512018-04-19 13:45:50 +0200181if (TFM_PSA_API)
182 add_definitions(-DTFM_PSA_API)
183endif()
184
David Hu104388f2019-11-18 14:37:32 +0800185if (DEFINED TFM_MULTI_CORE_TOPOLOGY AND TFM_MULTI_CORE_TOPOLOGY)
186 add_definitions(-DTFM_MULTI_CORE_TOPOLOGY)
187endif()
188
Miklos Balint87da2512018-04-19 13:45:50 +0200189if (TFM_LEGACY_API)
190 add_definitions(-DTFM_LEGACY_API)
191endif()
192
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100193if (SERVICES_TEST_ENABLED)
194 set(SERVICE_TEST_S ON)
195 set(SERVICE_TEST_NS ON)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100196endif()
197
198if (CORE_TEST)
Mate Toth-Pal6569a592019-06-07 12:09:50 +0200199 set(CORE_TEST_POSITIVE ON)
200 set(CORE_TEST_INTERACTIVE OFF)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100201endif()
202
Ben Davis6d7256b2018-04-18 14:16:53 +0100203if (CORE_TEST_INTERACTIVE)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100204 add_definitions(-DCORE_TEST_INTERACTIVE)
205 set(TEST_FRAMEWORK_NS ON)
Mate Toth-Pal349714a2018-02-23 15:30:24 +0100206 set(TFM_PARTITION_TEST_CORE ON)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100207endif()
208
Ben Davis6d7256b2018-04-18 14:16:53 +0100209if (CORE_TEST_POSITIVE)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100210 add_definitions(-DCORE_TEST_POSITIVE)
211 set(TEST_FRAMEWORK_NS ON)
Mate Toth-Pal349714a2018-02-23 15:30:24 +0100212 set(TFM_PARTITION_TEST_CORE ON)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100213endif()
214
David Hu33f2fd22019-08-16 15:32:39 +0800215if (TFM_PARTITION_TEST_CORE)
216 # If the platform or the topology doesn't specify whether IRQ test is
217 # supported, enable it by default.
218 if (NOT DEFINED TFM_ENABLE_IRQ_TEST)
219 set(TFM_ENABLE_IRQ_TEST ON)
220 endif()
221
222 if (TFM_ENABLE_IRQ_TEST)
223 add_definitions(-DTFM_ENABLE_IRQ_TEST)
224 endif()
225else()
226 set(TFM_ENABLE_IRQ_TEST OFF)
227endif()
228
David Huf2cfa122019-08-27 15:32:38 +0800229if (IPC_TEST)
230 add_definitions(-DENABLE_IPC_TEST)
Jamie Foxadf02552019-05-16 17:44:52 +0100231 set(TEST_FRAMEWORK_NS ON)
232 set(TFM_PARTITION_TEST_CORE_IPC ON)
Edison Aiec109cd2018-07-17 16:04:14 +0800233endif()
234
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100235if (SERVICE_TEST_S)
236 add_definitions(-DSERVICES_TEST_S)
237 set(TEST_FRAMEWORK_S ON)
238endif()
239
240if (SERVICE_TEST_NS)
241 add_definitions(-DSERVICES_TEST_NS)
242 set(TEST_FRAMEWORK_NS ON)
243endif()
244
Ben Davis6d7256b2018-04-18 14:16:53 +0100245if (TEST_FRAMEWORK_S)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100246 add_definitions(-DTEST_FRAMEWORK_S)
Jamie Fox56da0992019-05-28 14:35:06 +0100247 # The secure client partition is required to run secure tests
248 set(TFM_PARTITION_TEST_SECURE_SERVICES ON)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100249endif()
250
Ben Davis6d7256b2018-04-18 14:16:53 +0100251if (TEST_FRAMEWORK_NS)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100252 add_definitions(-DTEST_FRAMEWORK_NS)
253endif()
254
Jamie Foxc78c62c2019-05-23 13:42:17 +0100255if (CORE_IPC)
256 set(TFM_PARTITION_AUDIT_LOG OFF)
257endif()
258
259if (TFM_PARTITION_AUDIT_LOG)
260 add_definitions(-DTFM_PARTITION_AUDIT_LOG)
261endif()
262
Mingyang Sun9511e5e2019-05-29 18:18:44 +0800263if (TFM_PARTITION_PLATFORM)
264 add_definitions(-DTFM_PARTITION_PLATFORM)
265endif()
266
Mate Toth-Pal349714a2018-02-23 15:30:24 +0100267if (TFM_PARTITION_TEST_CORE)
268 add_definitions(-DTFM_PARTITION_TEST_CORE)
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100269endif()
270
Jamie Foxadf02552019-05-16 17:44:52 +0100271if (TFM_PARTITION_TEST_CORE_IPC)
272 add_definitions(-DTFM_PARTITION_TEST_CORE_IPC)
273endif()
274
Jamie Foxc78c62c2019-05-23 13:42:17 +0100275if (TFM_PARTITION_TEST_SECURE_SERVICES)
276 add_definitions(-DTFM_PARTITION_TEST_SECURE_SERVICES)
277endif()
278
Jamie Fox17c30bb2019-01-10 13:39:33 +0000279if (PSA_API_TEST)
280 add_definitions(-DPSA_API_TEST_NS)
281 set(PSA_API_TEST_NS ON)
282 if (NOT DEFINED PSA_API_TEST_CRYPTO)
283 set(PSA_API_TEST_CRYPTO OFF)
284 endif()
Jamie Fox6b6a19b2019-09-30 16:54:17 +0100285 if (NOT DEFINED PSA_API_TEST_INTERNAL_TRUSTED_STORAGE)
286 set(PSA_API_TEST_INTERNAL_TRUSTED_STORAGE OFF)
287 endif()
Jamie Fox17c30bb2019-01-10 13:39:33 +0000288 if (NOT DEFINED PSA_API_TEST_SECURE_STORAGE)
289 set(PSA_API_TEST_SECURE_STORAGE OFF)
290 endif()
291 if (NOT DEFINED PSA_API_TEST_ATTESTATION)
292 set(PSA_API_TEST_ATTESTATION OFF)
293 endif()
294endif()
295
Marc Moreno Berenguec2e4db82018-09-14 16:32:24 +0100296# This flag indicates if the non-secure OS is capable of identify the non-secure clients
Mingyang Sun9ac02372019-08-26 15:59:14 +0800297# which call the secure services. It is diabled in IPC model.
Marc Moreno Berenguec2e4db82018-09-14 16:32:24 +0100298if (NOT DEFINED TFM_NS_CLIENT_IDENTIFICATION)
Mingyang Sun9ac02372019-08-26 15:59:14 +0800299 if (TFM_PSA_API)
300 set(TFM_NS_CLIENT_IDENTIFICATION OFF)
301 else()
302 set(TFM_NS_CLIENT_IDENTIFICATION ON)
303 endif()
Marc Moreno Berenguec2e4db82018-09-14 16:32:24 +0100304endif()
305
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100306if (BL2)
David Vincze63eda7a2019-08-09 17:42:51 +0200307 # Add MCUBOOT_IMAGE_NUMBER definition to the compiler command line.
308 add_definitions(-DMCUBOOT_IMAGE_NUMBER=${MCUBOOT_IMAGE_NUMBER})
309
David Vincze4638b2a2019-05-24 10:14:23 +0200310 if (${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "NO_SWAP")
Tamas Bandb69d522018-03-01 10:04:41 +0000311 set(LINK_TO_BOTH_MEMORY_REGION ON)
312 endif()
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100313endif()
314
Raef Coles1bb168e2019-10-17 09:04:55 +0100315##Set Mbed Crypto compiler flags and variables for crypto service
316set(MBEDCRYPTO_C_FLAGS_SERVICES "-D__ARM_FEATURE_CMSE=${ARM_FEATURE_CMSE} -D__thumb2__ ${COMMON_COMPILE_FLAGS_STR} -I${CMAKE_CURRENT_LIST_DIR}/platform/ext/common")
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100317
Marc Moreno Berengue6ffb22f2018-02-20 13:46:30 +0000318#Default TF-M secure storage flags.
319#These flags values can be overwritten by setting them in platform/ext/<TARGET_NAME>.cmake
Tamas Ban01f64c52019-08-26 13:46:21 +0100320#Documentation about these flags can be found in docs/user_guides/services/tfm_sst_integration_guide.rst
Marc Moreno Berengue8385e8e2019-01-21 11:49:50 +0000321if (NOT DEFINED SST_ENCRYPTION)
322 set (SST_ENCRYPTION ON)
323endif()
Marc Moreno Berengue6ffb22f2018-02-20 13:46:30 +0000324
Marc Moreno Berengue8385e8e2019-01-21 11:49:50 +0000325if (NOT DEFINED SST_ROLLBACK_PROTECTION)
326 set (SST_ROLLBACK_PROTECTION OFF)
327endif()
Marc Moreno Berengue6ffb22f2018-02-20 13:46:30 +0000328
Marc Moreno Berengue8385e8e2019-01-21 11:49:50 +0000329if (NOT DEFINED SST_CREATE_FLASH_LAYOUT)
330 set (SST_CREATE_FLASH_LAYOUT OFF)
331endif()
Marc Moreno Berengue184d2032018-08-14 12:51:43 +0100332
Marc Moreno Berengue8385e8e2019-01-21 11:49:50 +0000333if (NOT DEFINED SST_VALIDATE_METADATA_FROM_FLASH)
334 set (SST_VALIDATE_METADATA_FROM_FLASH ON)
335endif()
Marc Moreno Berengue6ffb22f2018-02-20 13:46:30 +0000336
Marc Moreno Berengue8385e8e2019-01-21 11:49:50 +0000337if (NOT DEFINED SST_RAM_FS)
338 if (REGRESSION)
339 set (SST_RAM_FS ON)
340 else()
341 set (SST_RAM_FS OFF)
Marc Moreno Berengue02a23442018-08-15 14:28:45 +0100342 endif()
Marc Moreno Berengue792fc682018-02-20 11:53:30 +0000343endif()
Marc Moreno Berengue6ffb22f2018-02-20 13:46:30 +0000344
Jamie Fox95bacd42019-03-21 18:14:15 +0000345if (NOT DEFINED SST_TEST_NV_COUNTERS)
346 if (REGRESSION AND (TFM_LVL EQUAL 1))
347 set(SST_TEST_NV_COUNTERS ON)
348 else()
349 set(SST_TEST_NV_COUNTERS OFF)
350 endif()
351endif()
352
Jamie Fox0e823a02019-10-28 17:28:19 +0000353# The SST NV counter tests depend on the SST test partition to call
354# sst_system_prepare().
355if (SST_TEST_NV_COUNTERS)
356 set(TFM_PARTITION_TEST_SST ON)
357 add_definitions(-DTFM_PARTITION_TEST_SST)
358endif()
359
TudorCretufb182bc2019-07-05 17:34:12 +0100360#Default TF-M internal trusted storage flags.
361#These flags values can be overwritten by setting them in platform/ext/<TARGET_NAME>.cmake
362#Documentation about these flags can be found in the TF-M ITS integration guide
363option(ITS_CREATE_FLASH_LAYOUT "Create an empty ITS Flash Layout" OFF)
364
365if (NOT DEFINED ITS_VALIDATE_METADATA_FROM_FLASH)
366 set (ITS_VALIDATE_METADATA_FROM_FLASH ON)
367endif()
368
369if (NOT DEFINED ITS_RAM_FS)
370 if (REGRESSION)
371 set (ITS_RAM_FS ON)
372 else()
373 set (ITS_RAM_FS OFF)
374 endif()
375endif()
376
Raef Coles1bb168e2019-10-17 09:04:55 +0100377if (NOT DEFINED MBEDCRYPTO_DEBUG)
378 set(MBEDCRYPTO_DEBUG OFF)
Marc Moreno Berengue6ffb22f2018-02-20 13:46:30 +0000379endif()
Mate Toth-Pal65c935e2018-01-17 18:42:13 +0100380
Tamas Ban01f64c52019-08-26 13:46:21 +0100381#Default TF-M initial-attestation service flags.
382#Documentation about these flags can be found in docs/user_guides/services/tfm_attestation_integration_guide.rst
383if (NOT DEFINED ATTEST_INCLUDE_OPTIONAL_CLAIMS)
384 set(ATTEST_INCLUDE_OPTIONAL_CLAIMS ON)
385endif()
386
Raef Colesb321c0b2019-10-15 08:49:17 +0100387if (CMAKE_BUILD_TYPE STREQUAL "debug")
Tamas Ban303dd082019-08-27 10:43:03 +0100388 set(ATTEST_INCLUDE_TEST_CODE_AND_KEY_ID ON)
389else()
390 set(ATTEST_INCLUDE_TEST_CODE_AND_KEY_ID OFF)
391endif()
392
David Vincze00dceb12019-09-17 17:34:03 +0200393set(ATTEST_BOOT_INTERFACE "CBOR_ENCODED_CLAIMS" CACHE STRING "Set the format in which to pass the claims to the initial-attestation service.")
David Vincze219a1752019-10-14 11:35:09 +0200394set_property(CACHE ATTEST_BOOT_INTERFACE PROPERTY STRINGS "INDIVIDUAL_CLAIMS;CBOR_ENCODED_CLAIMS")
395validate_cache_value(ATTEST_BOOT_INTERFACE)
396
Tamas Bandb69d522018-03-01 10:04:41 +0000397##Set mbedTLS compiler flags for BL2 bootloader
David Vinczecea8b592019-10-29 16:09:51 +0100398set(MBEDCRYPTO_C_FLAGS_BL2 "-D__ARM_FEATURE_CMSE=${ARM_FEATURE_CMSE} -D__thumb2__ ${COMMON_COMPILE_FLAGS_STR} -DMBEDTLS_CONFIG_FILE=\\\\\\\"config-rsa.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/bl2/ext/mcuboot/include")
Tamas Ban7801ed42019-05-20 13:21:53 +0100399if (MCUBOOT_SIGNATURE_TYPE STREQUAL "RSA-3072")
Raef Coles1bb168e2019-10-17 09:04:55 +0100400 string(APPEND MBEDCRYPTO_C_FLAGS_BL2 " -DMCUBOOT_SIGN_RSA_LEN=3072")
Jamie Foxc78c62c2019-05-23 13:42:17 +0100401endif()