Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Jamie Fox | 17c30bb | 2019-01-10 13:39:33 +0000 | [diff] [blame] | 2 | # Copyright (c) 2018-2019, Arm Limited. All rights reserved. |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | if(NOT DEFINED REGRESSION) |
| 9 | message(FATAL_ERROR "ERROR: Incomplete Configuration: REGRESSION not defined, Include this file from a Config*.cmake") |
| 10 | elseif(NOT DEFINED CORE_TEST) |
| 11 | message(FATAL_ERROR "ERROR: Incomplete Configuration: CORE_TEST not defined, Include this file from a Config*.cmake") |
Tamas Ban | d90c81b | 2018-08-15 15:03:42 +0100 | [diff] [blame] | 12 | elseif(NOT DEFINED TFM_LVL) |
| 13 | message(FATAL_ERROR "ERROR: Incomplete Configuration: TFM_LVL not defined, Include this file from a Config*.cmake") |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 14 | endif() |
| 15 | |
Mate Toth-Pal | ee551bc | 2018-06-12 16:40:45 +0200 | [diff] [blame] | 16 | if(NOT DEFINED COMPILER) |
| 17 | message(FATAL_ERROR "ERROR: COMPILER is not set in command line") |
| 18 | elseif((NOT ${COMPILER} STREQUAL "ARMCLANG") AND (NOT ${COMPILER} STREQUAL "GNUARM")) |
| 19 | message(FATAL_ERROR "ERROR: Compiler \"${COMPILER}\" is not supported.") |
| 20 | endif() |
| 21 | |
David Vincze | 4638b2a | 2019-05-24 10:14:23 +0200 | [diff] [blame] | 22 | #BL2 bootloader (MCUBoot) related settings |
| 23 | if(NOT DEFINED BL2) |
| 24 | set(BL2 True CACHE BOOL "Configure TF-M to use BL2 and enable building BL2") |
| 25 | endif() |
| 26 | if (BL2) |
| 27 | if (NOT DEFINED MCUBOOT_UPGRADE_STRATEGY) |
David Vincze | 8a2a4e2 | 2019-05-24 10:14:23 +0200 | [diff] [blame] | 28 | set (MCUBOOT_UPGRADE_STRATEGY "OVERWRITE_ONLY" CACHE STRING "Configure BL2 which upgrade strategy to use") |
David Vincze | 4638b2a | 2019-05-24 10:14:23 +0200 | [diff] [blame] | 29 | set_property(CACHE MCUBOOT_UPGRADE_STRATEGY PROPERTY STRINGS "OVERWRITE_ONLY;SWAP;NO_SWAP;RAM_LOADING") |
| 30 | endif() |
| 31 | endif() |
| 32 | |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 33 | set(BUILD_CMSIS_CORE Off) |
| 34 | set(BUILD_RETARGET Off) |
| 35 | set(BUILD_NATIVE_DRIVERS Off) |
| 36 | set(BUILD_TIME Off) |
| 37 | set(BUILD_STARTUP Off) |
| 38 | set(BUILD_TARGET_CFG Off) |
| 39 | set(BUILD_TARGET_HARDWARE_KEYS Off) |
Marc Moreno Berengue | 4cc81fc | 2018-08-10 14:32:01 +0100 | [diff] [blame] | 40 | set(BUILD_TARGET_NV_COUNTERS Off) |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 41 | set(BUILD_CMSIS_DRIVERS Off) |
| 42 | set(BUILD_UART_STDOUT Off) |
| 43 | set(BUILD_FLASH Off) |
Tamas Ban | 3681ce0 | 2018-11-22 15:19:24 +0000 | [diff] [blame] | 44 | set(BUILD_BOOT_SEED Off) |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 45 | set(BUILD_DEVICE_ID Off) |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 46 | if(NOT DEFINED PLATFORM_CMAKE_FILE) |
| 47 | message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.") |
| 48 | elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE}) |
| 49 | message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.") |
| 50 | else() |
| 51 | include(${PLATFORM_CMAKE_FILE}) |
| 52 | endif() |
| 53 | |
Oliver Swede | 2144044 | 2018-07-10 09:31:32 +0100 | [diff] [blame] | 54 | if (NOT DEFINED IMAGE_VERSION) |
Jamie Fox | 7a4170d | 2018-08-15 14:13:42 +0100 | [diff] [blame] | 55 | set(IMAGE_VERSION 0.0.0+0) |
Oliver Swede | 2144044 | 2018-07-10 09:31:32 +0100 | [diff] [blame] | 56 | endif() |
| 57 | |
Mate Toth-Pal | ee551bc | 2018-06-12 16:40:45 +0200 | [diff] [blame] | 58 | if(${COMPILER} STREQUAL "ARMCLANG") |
Mate Toth-Pal | 7686726 | 2018-03-09 13:15:36 +0100 | [diff] [blame] | 59 | #Use any ARMCLANG version found on PATH. Note: Only versions supported by the |
| 60 | #build system will work. A file cmake/Common/CompilerArmClangXY.cmake |
| 61 | #must be present with a matching version. |
| 62 | include("Common/FindArmClang") |
| 63 | include("Common/${ARMCLANG_MODULE}") |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 64 | |
Mate Toth-Pal | 7686726 | 2018-03-09 13:15:36 +0100 | [diff] [blame] | 65 | set (COMMON_COMPILE_FLAGS -fshort-enums -fshort-wchar -funsigned-char -mfpu=none -mcmse) |
Tamas Ban | db69d52 | 2018-03-01 10:04:41 +0000 | [diff] [blame] | 66 | ##Shared compiler settings. |
| 67 | function(config_setting_shared_compiler_flags tgt) |
Mate Toth-Pal | 7686726 | 2018-03-09 13:15:36 +0100 | [diff] [blame] | 68 | embedded_set_target_compile_flags(TARGET ${tgt} LANGUAGE C FLAGS -xc -std=c99 ${COMMON_COMPILE_FLAGS} -Wall -Werror) |
Tamas Ban | db69d52 | 2018-03-01 10:04:41 +0000 | [diff] [blame] | 69 | endfunction() |
| 70 | |
| 71 | ##Shared linker settings. |
| 72 | function(config_setting_shared_linker_flags tgt) |
Mate Toth-Pal | 7686726 | 2018-03-09 13:15:36 +0100 | [diff] [blame] | 73 | embedded_set_target_link_flags(TARGET ${tgt} FLAGS --strict --map --symbols --xref --entry=Reset_Handler --info=summarysizes,sizes,totals,unused,veneers) |
| 74 | endfunction() |
| 75 | elseif(${COMPILER} STREQUAL "GNUARM") |
| 76 | #Use any GNUARM version found on PATH. Note: Only versions supported by the |
| 77 | #build system will work. A file cmake/Common/CompilerGNUARMXY.cmake |
| 78 | #must be present with a matching version. |
| 79 | include("Common/FindGNUARM") |
| 80 | include("Common/${GNUARM_MODULE}") |
Mate Toth-Pal | 48fc6a0 | 2018-01-24 09:50:14 +0100 | [diff] [blame] | 81 | |
Mate Toth-Pal | f64f1eb | 2018-04-26 17:22:37 +0200 | [diff] [blame] | 82 | set (COMMON_COMPILE_FLAGS -fshort-enums -fshort-wchar -funsigned-char -msoft-float -mcmse --specs=nano.specs) |
Mate Toth-Pal | 7686726 | 2018-03-09 13:15:36 +0100 | [diff] [blame] | 83 | ##Shared compiler and linker settings. |
Tamas Ban | db69d52 | 2018-03-01 10:04:41 +0000 | [diff] [blame] | 84 | function(config_setting_shared_compiler_flags tgt) |
Mate Toth-Pal | 7686726 | 2018-03-09 13:15:36 +0100 | [diff] [blame] | 85 | 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 Ban | db69d52 | 2018-03-01 10:04:41 +0000 | [diff] [blame] | 86 | endfunction() |
| 87 | |
| 88 | ##Shared linker settings. |
| 89 | function(config_setting_shared_linker_flags tgt) |
Mate Toth-Pal | 7686726 | 2018-03-09 13:15:36 +0100 | [diff] [blame] | 90 | #--no-wchar-size-warning flag is added because TF-M sources are compiled |
| 91 | #with short wchars, however the standard library is compiled with normal |
| 92 | #wchar, and this generates linker time warnings. TF-M code does not use |
| 93 | #wchar, so the warning can be suppressed. |
Karl Zhang | b3b9d95 | 2018-08-07 21:47:11 +0800 | [diff] [blame] | 94 | embedded_set_target_link_flags(TARGET ${tgt} FLAGS -Xlinker -check-sections -Xlinker -fatal-warnings --entry=Reset_Handler -Wl,--no-wchar-size-warning --specs=nano.specs |
| 95 | -Wl,--print-memory-usage) |
Mate Toth-Pal | 7686726 | 2018-03-09 13:15:36 +0100 | [diff] [blame] | 96 | endfunction() |
Mate Toth-Pal | 7686726 | 2018-03-09 13:15:36 +0100 | [diff] [blame] | 97 | endif() |
| 98 | |
| 99 | #Create a string from the compile flags list, so that it can be used later |
| 100 | #in this file to set mbedtls and BL2 flags |
Tamas Ban | db69d52 | 2018-03-01 10:04:41 +0000 | [diff] [blame] | 101 | list_to_string(COMMON_COMPILE_FLAGS_STR ${COMMON_COMPILE_FLAGS}) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 102 | |
| 103 | #Settings which shall be set for all projects the same way based |
| 104 | # on the variables above. |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 105 | set (TFM_PARTITION_TEST_CORE OFF) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 106 | set (CORE_TEST_POSITIVE OFF) |
| 107 | set (CORE_TEST_INTERACTIVE OFF) |
Ben Davis | 6d7256b | 2018-04-18 14:16:53 +0100 | [diff] [blame] | 108 | set (TEST_FRAMEWORK_S OFF) |
Miklos Balint | f13ec02 | 2018-04-06 17:21:22 +0200 | [diff] [blame] | 109 | set (REFERENCE_PLATFORM OFF) |
Ben Davis | 6d7256b | 2018-04-18 14:16:53 +0100 | [diff] [blame] | 110 | set (TFM_PARTITION_TEST_SECURE_SERVICES OFF) |
Tamas Ban | d90c81b | 2018-08-15 15:03:42 +0100 | [diff] [blame] | 111 | set (SERVICES_TEST_ENABLED OFF) |
Marc Moreno Berengue | cae2c53 | 2018-10-09 12:58:46 +0100 | [diff] [blame] | 112 | set (TEST_FRAMEWORK_S OFF) |
| 113 | set (TEST_FRAMEWORK_NS OFF) |
Edison Ai | ec109cd | 2018-07-17 16:04:14 +0800 | [diff] [blame] | 114 | set (TFM_PSA_API OFF) |
Miklos Balint | 87da251 | 2018-04-19 13:45:50 +0200 | [diff] [blame] | 115 | set (TFM_LEGACY_API ON) |
Edison Ai | ec109cd | 2018-07-17 16:04:14 +0800 | [diff] [blame] | 116 | set (CORE_TEST_IPC OFF) |
Miklos Balint | f13ec02 | 2018-04-06 17:21:22 +0200 | [diff] [blame] | 117 | |
| 118 | if(${TARGET_PLATFORM} STREQUAL "AN521" OR ${TARGET_PLATFORM} STREQUAL "AN519") |
| 119 | set (REFERENCE_PLATFORM ON) |
| 120 | endif() |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 121 | |
Miklos Balint | 6cbeba6 | 2018-04-12 17:31:34 +0200 | [diff] [blame] | 122 | # Option to demonstrate usage of secure-only peripheral |
| 123 | set (SECURE_UART1 OFF) |
| 124 | |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 125 | if (REGRESSION) |
| 126 | set(SERVICES_TEST_ENABLED ON) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 127 | endif() |
| 128 | |
Edison Ai | ec109cd | 2018-07-17 16:04:14 +0800 | [diff] [blame] | 129 | if (CORE_IPC) |
| 130 | set(TFM_PSA_API ON) |
| 131 | set(CORE_TEST_IPC ON) |
| 132 | endif() |
| 133 | |
Miklos Balint | 87da251 | 2018-04-19 13:45:50 +0200 | [diff] [blame] | 134 | if (TFM_PSA_API) |
| 135 | add_definitions(-DTFM_PSA_API) |
| 136 | endif() |
| 137 | |
| 138 | if (TFM_LEGACY_API) |
| 139 | add_definitions(-DTFM_LEGACY_API) |
| 140 | endif() |
| 141 | |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 142 | if (SERVICES_TEST_ENABLED) |
| 143 | set(SERVICE_TEST_S ON) |
| 144 | set(SERVICE_TEST_NS ON) |
Edison Ai | 699d58e | 2019-05-22 18:03:41 +0800 | [diff] [blame] | 145 | if (REFERENCE_PLATFORM AND NOT CORE_IPC) |
Miklos Balint | f13ec02 | 2018-04-06 17:21:22 +0200 | [diff] [blame] | 146 | set(CORE_TEST_POSITIVE ON) |
| 147 | endif() |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 148 | endif() |
| 149 | |
| 150 | if (CORE_TEST) |
| 151 | set(CORE_TEST_POSITIVE ON) |
| 152 | set(CORE_TEST_INTERACTIVE OFF) |
Jamie Fox | 17c30bb | 2019-01-10 13:39:33 +0000 | [diff] [blame] | 153 | set(TFM_PARTITION_TEST_SECURE_SERVICES ON) |
Tamas Ban | 244f08c | 2018-09-20 22:02:30 +0100 | [diff] [blame] | 154 | add_definitions(-DTFM_PARTITION_TEST_SECURE_SERVICES) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 155 | endif() |
| 156 | |
Ben Davis | 6d7256b | 2018-04-18 14:16:53 +0100 | [diff] [blame] | 157 | if (CORE_TEST_INTERACTIVE) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 158 | add_definitions(-DCORE_TEST_INTERACTIVE) |
| 159 | set(TEST_FRAMEWORK_NS ON) |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 160 | set(TFM_PARTITION_TEST_CORE ON) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 161 | endif() |
| 162 | |
Ben Davis | 6d7256b | 2018-04-18 14:16:53 +0100 | [diff] [blame] | 163 | if (CORE_TEST_POSITIVE) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 164 | add_definitions(-DCORE_TEST_POSITIVE) |
| 165 | set(TEST_FRAMEWORK_NS ON) |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 166 | set(TFM_PARTITION_TEST_CORE ON) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 167 | endif() |
| 168 | |
Edison Ai | ec109cd | 2018-07-17 16:04:14 +0800 | [diff] [blame] | 169 | if (CORE_TEST_IPC) |
| 170 | add_definitions(-DCORE_TEST_IPC) |
Edison Ai | 7d6cb3b | 2018-09-19 16:41:50 +0800 | [diff] [blame] | 171 | set(TFM_PARTITION_TEST_SECURE_SERVICES ON) |
Antonio de Angelis | 4743e67 | 2019-04-11 11:38:48 +0100 | [diff] [blame] | 172 | # If PSA_API_TEST is enabled, don't run TF-M test framework from NS |
| 173 | if (PSA_API_TEST) |
| 174 | set(TEST_FRAMEWORK_NS OFF) |
| 175 | else() |
| 176 | set(TEST_FRAMEWORK_NS ON) |
| 177 | endif() |
Edison Ai | ec109cd | 2018-07-17 16:04:14 +0800 | [diff] [blame] | 178 | endif() |
| 179 | |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 180 | if (SERVICE_TEST_S) |
| 181 | add_definitions(-DSERVICES_TEST_S) |
| 182 | set(TEST_FRAMEWORK_S ON) |
Ben Davis | 6d7256b | 2018-04-18 14:16:53 +0100 | [diff] [blame] | 183 | set(TFM_PARTITION_TEST_SECURE_SERVICES ON) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 184 | endif() |
| 185 | |
Edison Ai | 7d6cb3b | 2018-09-19 16:41:50 +0800 | [diff] [blame] | 186 | if (TFM_PARTITION_TEST_SECURE_SERVICES) |
| 187 | add_definitions(-DTFM_PARTITION_TEST_SECURE_SERVICES) |
| 188 | endif() |
| 189 | |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 190 | if (SERVICE_TEST_NS) |
| 191 | add_definitions(-DSERVICES_TEST_NS) |
| 192 | set(TEST_FRAMEWORK_NS ON) |
| 193 | endif() |
| 194 | |
Ben Davis | 6d7256b | 2018-04-18 14:16:53 +0100 | [diff] [blame] | 195 | if (TEST_FRAMEWORK_S) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 196 | add_definitions(-DTEST_FRAMEWORK_S) |
| 197 | endif() |
| 198 | |
Ben Davis | 6d7256b | 2018-04-18 14:16:53 +0100 | [diff] [blame] | 199 | if (TEST_FRAMEWORK_NS) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 200 | add_definitions(-DTEST_FRAMEWORK_NS) |
| 201 | endif() |
| 202 | |
Mate Toth-Pal | 349714a | 2018-02-23 15:30:24 +0100 | [diff] [blame] | 203 | if (TFM_PARTITION_TEST_CORE) |
| 204 | add_definitions(-DTFM_PARTITION_TEST_CORE) |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 205 | endif() |
| 206 | |
Jamie Fox | 17c30bb | 2019-01-10 13:39:33 +0000 | [diff] [blame] | 207 | if (PSA_API_TEST) |
| 208 | add_definitions(-DPSA_API_TEST_NS) |
| 209 | set(PSA_API_TEST_NS ON) |
| 210 | if (NOT DEFINED PSA_API_TEST_CRYPTO) |
| 211 | set(PSA_API_TEST_CRYPTO OFF) |
| 212 | endif() |
| 213 | if (NOT DEFINED PSA_API_TEST_SECURE_STORAGE) |
| 214 | set(PSA_API_TEST_SECURE_STORAGE OFF) |
| 215 | endif() |
| 216 | if (NOT DEFINED PSA_API_TEST_ATTESTATION) |
| 217 | set(PSA_API_TEST_ATTESTATION OFF) |
| 218 | endif() |
| 219 | endif() |
| 220 | |
Marc Moreno Berengue | c2e4db8 | 2018-09-14 16:32:24 +0100 | [diff] [blame] | 221 | # This flag indicates if the non-secure OS is capable of identify the non-secure clients |
| 222 | # which call the secure services |
| 223 | if (NOT DEFINED TFM_NS_CLIENT_IDENTIFICATION) |
| 224 | set (TFM_NS_CLIENT_IDENTIFICATION ON) |
| 225 | endif() |
| 226 | |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 227 | if (BL2) |
| 228 | add_definitions(-DBL2) |
Tamas Ban | 7801ed4 | 2019-05-20 13:21:53 +0100 | [diff] [blame] | 229 | if (NOT ${MCUBOOT_SIGNATURE_TYPE} STREQUAL "RSA-2048" AND NOT ${MCUBOOT_SIGNATURE_TYPE} STREQUAL "RSA-3072") |
| 230 | message(FATAL_ERROR "MCUBoot only supports RSA-2048 and RSA-3072 signature") |
| 231 | endif() |
| 232 | if (NOT DEFINED MCUBOOT_SIGNATURE_TYPE) |
Tamas Ban | 81daed0 | 2019-05-20 15:05:22 +0100 | [diff] [blame] | 233 | set(MCUBOOT_SIGNATURE_TYPE "RSA-3072") |
Tamas Ban | 7801ed4 | 2019-05-20 13:21:53 +0100 | [diff] [blame] | 234 | endif() |
David Vincze | 4638b2a | 2019-05-24 10:14:23 +0200 | [diff] [blame] | 235 | if (NOT ${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "OVERWRITE_ONLY" AND |
| 236 | NOT ${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "SWAP" AND |
| 237 | NOT ${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "NO_SWAP" AND |
| 238 | NOT ${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "RAM_LOADING") |
| 239 | message(FATAL_ERROR "ERROR: MCUBoot supports OVERWRITE_ONLY, SWAP, NO_SWAP and RAM_LOADING upgrade strategies only.") |
| 240 | endif() |
| 241 | if (${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "NO_SWAP") |
Tamas Ban | db69d52 | 2018-03-01 10:04:41 +0000 | [diff] [blame] | 242 | set(LINK_TO_BOTH_MEMORY_REGION ON) |
| 243 | endif() |
David Vincze | 4638b2a | 2019-05-24 10:14:23 +0200 | [diff] [blame] | 244 | else() #BL2 is turned off |
| 245 | if (DEFINED MCUBOOT_UPGRADE_STRATEGY) |
| 246 | message (WARNING "Ignoring value of MCUBOOT_UPGRADE_STRATEGY as BL2 option is set to False.") |
| 247 | unset (MCUBOOT_UPGRADE_STRATEGY) |
Tamas Ban | db69d52 | 2018-03-01 10:04:41 +0000 | [diff] [blame] | 248 | endif() |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 249 | endif() |
| 250 | |
Jamie Fox | daade49 | 2019-04-26 14:35:39 +0100 | [diff] [blame] | 251 | ##Set Mbed TLS compiler flags and variables for audit log and crypto |
Jamie Fox | 0e54ebc | 2019-04-09 14:21:04 +0100 | [diff] [blame] | 252 | set(MBEDTLS_C_FLAGS_SERVICES "-D__ARM_FEATURE_CMSE=3 -D__thumb2__ ${COMMON_COMPILE_FLAGS_STR} -I${CMAKE_CURRENT_LIST_DIR}/platform/ext/common") |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 253 | |
Marc Moreno Berengue | 6ffb22f | 2018-02-20 13:46:30 +0000 | [diff] [blame] | 254 | #Default TF-M secure storage flags. |
| 255 | #These flags values can be overwritten by setting them in platform/ext/<TARGET_NAME>.cmake |
Marc Moreno Berengue | f6a64f7 | 2018-07-26 17:33:38 +0100 | [diff] [blame] | 256 | #Documentation about these flags can be found in docs/user_guides/services/tfm_sst_integration_guide.md |
Marc Moreno Berengue | 8385e8e | 2019-01-21 11:49:50 +0000 | [diff] [blame] | 257 | if (NOT DEFINED SST_ENCRYPTION) |
| 258 | set (SST_ENCRYPTION ON) |
| 259 | endif() |
Marc Moreno Berengue | 6ffb22f | 2018-02-20 13:46:30 +0000 | [diff] [blame] | 260 | |
Marc Moreno Berengue | 8385e8e | 2019-01-21 11:49:50 +0000 | [diff] [blame] | 261 | if (NOT DEFINED SST_ROLLBACK_PROTECTION) |
| 262 | set (SST_ROLLBACK_PROTECTION OFF) |
| 263 | endif() |
Marc Moreno Berengue | 6ffb22f | 2018-02-20 13:46:30 +0000 | [diff] [blame] | 264 | |
Marc Moreno Berengue | 8385e8e | 2019-01-21 11:49:50 +0000 | [diff] [blame] | 265 | if (NOT DEFINED SST_CREATE_FLASH_LAYOUT) |
| 266 | set (SST_CREATE_FLASH_LAYOUT OFF) |
| 267 | endif() |
Marc Moreno Berengue | 184d203 | 2018-08-14 12:51:43 +0100 | [diff] [blame] | 268 | |
Marc Moreno Berengue | 8385e8e | 2019-01-21 11:49:50 +0000 | [diff] [blame] | 269 | if (NOT DEFINED SST_VALIDATE_METADATA_FROM_FLASH) |
| 270 | set (SST_VALIDATE_METADATA_FROM_FLASH ON) |
| 271 | endif() |
Marc Moreno Berengue | 6ffb22f | 2018-02-20 13:46:30 +0000 | [diff] [blame] | 272 | |
Marc Moreno Berengue | 8385e8e | 2019-01-21 11:49:50 +0000 | [diff] [blame] | 273 | if (NOT DEFINED SST_RAM_FS) |
| 274 | if (REGRESSION) |
| 275 | set (SST_RAM_FS ON) |
| 276 | else() |
| 277 | set (SST_RAM_FS OFF) |
Marc Moreno Berengue | 02a2344 | 2018-08-15 14:28:45 +0100 | [diff] [blame] | 278 | endif() |
Marc Moreno Berengue | 792fc68 | 2018-02-20 11:53:30 +0000 | [diff] [blame] | 279 | endif() |
Marc Moreno Berengue | 6ffb22f | 2018-02-20 13:46:30 +0000 | [diff] [blame] | 280 | |
Jamie Fox | 95bacd4 | 2019-03-21 18:14:15 +0000 | [diff] [blame] | 281 | if (NOT DEFINED SST_TEST_NV_COUNTERS) |
| 282 | if (REGRESSION AND (TFM_LVL EQUAL 1)) |
| 283 | set(SST_TEST_NV_COUNTERS ON) |
| 284 | else() |
| 285 | set(SST_TEST_NV_COUNTERS OFF) |
| 286 | endif() |
| 287 | endif() |
| 288 | |
Marc Moreno Berengue | 6ffb22f | 2018-02-20 13:46:30 +0000 | [diff] [blame] | 289 | if (NOT DEFINED MBEDTLS_DEBUG) |
Jamie Fox | 287885f | 2018-10-24 14:09:34 +0100 | [diff] [blame] | 290 | set(MBEDTLS_DEBUG OFF) |
Marc Moreno Berengue | 6ffb22f | 2018-02-20 13:46:30 +0000 | [diff] [blame] | 291 | endif() |
Mate Toth-Pal | 65c935e | 2018-01-17 18:42:13 +0100 | [diff] [blame] | 292 | |
Tamas Ban | db69d52 | 2018-03-01 10:04:41 +0000 | [diff] [blame] | 293 | ##Set mbedTLS compiler flags for BL2 bootloader |
Mate Toth-Pal | 7686726 | 2018-03-09 13:15:36 +0100 | [diff] [blame] | 294 | set(MBEDTLS_C_FLAGS_BL2 "-D__ARM_FEATURE_CMSE=3 -D__thumb2__ ${COMMON_COMPILE_FLAGS_STR} -DMBEDTLS_CONFIG_FILE=\\\\\\\"config-boot.h\\\\\\\" -I${CMAKE_CURRENT_LIST_DIR}/bl2/ext/mcuboot/include") |
Tamas Ban | 7801ed4 | 2019-05-20 13:21:53 +0100 | [diff] [blame] | 295 | if (MCUBOOT_SIGNATURE_TYPE STREQUAL "RSA-3072") |
| 296 | string(APPEND MBEDTLS_C_FLAGS_BL2 " -DMCUBOOT_SIGN_RSA_LEN=3072") |
| 297 | endif() |