Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
David Hu | 53d5bcb | 2022-01-14 14:10:50 +0800 | [diff] [blame] | 2 | # Copyright (c) 2020-2022, Arm Limited. All rights reserved. |
Chris Brand | db22899 | 2022-05-31 15:05:09 -0700 | [diff] [blame] | 3 | # Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company) |
| 4 | # or an affiliate of Cypress Semiconductor Corporation. All rights reserved. |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 5 | # |
| 6 | # SPDX-License-Identifier: BSD-3-Clause |
| 7 | # |
| 8 | #------------------------------------------------------------------------------- |
Raef Coles | 6981732 | 2020-10-19 14:14:14 +0100 | [diff] [blame] | 9 | cmake_minimum_required(VERSION 3.15) |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 10 | cmake_policy(SET CMP0076 NEW) |
| 11 | cmake_policy(SET CMP0079 NEW) |
| 12 | |
Chris Brand | db22899 | 2022-05-31 15:05:09 -0700 | [diff] [blame] | 13 | add_subdirectory(ns) |
| 14 | |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 15 | add_library(platform_s STATIC) |
| 16 | add_library(platform_region_defs INTERFACE) |
Raef Coles | a8f1ddf | 2021-05-25 15:47:25 +0100 | [diff] [blame] | 17 | add_library(platform_common_interface INTERFACE) |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 18 | |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 19 | if (BL2) |
| 20 | add_library(platform_bl2 STATIC) |
| 21 | endif() |
| 22 | |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 23 | if (BL1 AND PLATFORM_DEFAULT_BL1) |
| 24 | add_library(platform_bl1 STATIC) |
| 25 | add_library(platform_bl1_interface INTERFACE) |
| 26 | endif() |
| 27 | |
Raef Coles | 79809c7 | 2022-03-02 13:48:20 +0000 | [diff] [blame] | 28 | if (TFM_PARTITION_CRYPTO) |
| 29 | add_library(platform_crypto_keys STATIC) |
| 30 | endif() |
| 31 | |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 32 | set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) |
| 33 | |
Øyvind Rønningstad | 1dab74b | 2020-12-01 15:26:39 +0100 | [diff] [blame] | 34 | add_subdirectory(ext/target/${TFM_PLATFORM} target) |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 35 | |
Dávid Házi | 6f46229 | 2022-10-05 21:38:01 +0200 | [diff] [blame] | 36 | #====================== CMSIS stack override interface ========================# |
| 37 | |
| 38 | # NS linker scripts using the default CMSIS style naming conventions, while the |
| 39 | # secure and bl2 linker scripts remain untouched (region.h compatibility). |
| 40 | # To be compatible with the untouched files (which using ARMCLANG naming style), |
| 41 | # we have to override __INITIAL_SP and __STACK_LIMIT labels. |
| 42 | |
Dávid Házi | d80eeb4 | 2022-10-31 21:50:58 +0100 | [diff] [blame] | 43 | set(CMSIS_OVERRIDE_HEADER "${CMAKE_CURRENT_LIST_DIR}/include/cmsis_override.h") |
Dávid Házi | 6f46229 | 2022-10-05 21:38:01 +0200 | [diff] [blame] | 44 | add_library(cmsis_stack_override INTERFACE) |
Dávid Házi | d80eeb4 | 2022-10-31 21:50:58 +0100 | [diff] [blame] | 45 | target_compile_options(cmsis_stack_override |
Dávid Házi | 6f46229 | 2022-10-05 21:38:01 +0200 | [diff] [blame] | 46 | INTERFACE |
Dávid Házi | d80eeb4 | 2022-10-31 21:50:58 +0100 | [diff] [blame] | 47 | "$<$<C_COMPILER_ID:GNU>:SHELL:-include ${CMSIS_OVERRIDE_HEADER}>" |
| 48 | "$<$<C_COMPILER_ID:IAR>:SHELL:--preinclude ${CMSIS_OVERRIDE_HEADER}>" |
Dávid Házi | 6f46229 | 2022-10-05 21:38:01 +0200 | [diff] [blame] | 49 | ) |
| 50 | |
Raef Coles | a8f1ddf | 2021-05-25 15:47:25 +0100 | [diff] [blame] | 51 | #========================= Platform Common interface ==========================# |
| 52 | |
| 53 | target_include_directories(platform_common_interface |
| 54 | INTERFACE |
| 55 | ./ext |
| 56 | ./ext/cmsis |
| 57 | ./ext/common |
| 58 | ./ext/driver |
| 59 | ./include |
| 60 | ) |
| 61 | |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 62 | #========================= Platform Secure ====================================# |
| 63 | |
| 64 | target_include_directories(platform_s |
| 65 | PUBLIC |
Tamas Ban | 37aedb5 | 2020-10-01 10:54:48 +0100 | [diff] [blame] | 66 | $<$<BOOL:${CRYPTO_HW_ACCELERATOR}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/accelerator/interface> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 67 | ) |
| 68 | |
| 69 | target_sources(platform_s |
| 70 | PRIVATE |
Mark Horvath | b9ac0d5 | 2020-09-09 10:48:22 +0200 | [diff] [blame] | 71 | $<$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/common/tfm_hal_ps.c> |
| 72 | $<$<BOOL:${TFM_PARTITION_INTERNAL_TRUSTED_STORAGE}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/common/tfm_hal_its.c> |
Raef Coles | 236c188 | 2022-09-13 13:35:43 +0100 | [diff] [blame] | 73 | $<$<BOOL:${PLATFORM_DEFAULT_SYSTEM_RESET_HALT}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/common/tfm_hal_reset_halt.c> |
Gabor Abonyi | 931622b | 2020-10-19 15:08:40 +0200 | [diff] [blame] | 74 | $<$<BOOL:${PLATFORM_DEFAULT_UART_STDOUT}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/common/uart_stdout.c> |
David Hu | 52ff16f | 2021-08-20 11:39:37 +0800 | [diff] [blame] | 75 | $<$<BOOL:${TFM_SPM_LOG_RAW_ENABLED}>:ext/common/tfm_hal_spm_logdev_peripheral.c> |
Ken Liu | 2e43489 | 2022-02-16 12:10:16 +0800 | [diff] [blame] | 76 | $<$<BOOL:${TFM_EXCEPTION_INFO_DUMP}>:ext/common/exception_info.c> |
Summer Qin | df8716b | 2020-08-05 11:19:44 +0800 | [diff] [blame] | 77 | ext/common/tfm_hal_memory_symbols.c |
Raef Coles | 33ff153 | 2021-06-18 09:18:08 +0100 | [diff] [blame] | 78 | $<$<BOOL:${PLATFORM_DEFAULT_ATTEST_HAL}>:ext/common/template/attest_hal.c> |
| 79 | $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:ext/common/template/nv_counters.c> |
Raef Coles | 33ff153 | 2021-06-18 09:18:08 +0100 | [diff] [blame] | 80 | $<$<BOOL:${PLATFORM_DEFAULT_ROTPK}>:ext/common/template/tfm_rotpk.c> |
| 81 | $<$<BOOL:${PLATFORM_DEFAULT_NV_SEED}>:ext/common/template/crypto_nv_seed.c> |
David Hu | 0ed91d7 | 2022-03-14 21:08:49 +0800 | [diff] [blame] | 82 | $<$<AND:$<NOT:$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>>,$<BOOL:${TEST_S_ATTESTATION}>>:ext/common/template/tfm_initial_attest_pub_key.c> |
Jamie Fox | 6905d0c | 2022-06-21 16:03:12 +0100 | [diff] [blame] | 83 | $<$<OR:$<AND:$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>,$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>>,$<BOOL:${PLATFORM_DEFAULT_OTP}>>:ext/common/template/flash_otp_nv_counters_backend.c> |
Raef Coles | 148b947 | 2021-06-18 08:48:17 +0100 | [diff] [blame] | 84 | $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:ext/common/template/otp_flash.c> |
Raef Coles | aefbe08 | 2021-06-18 08:53:43 +0100 | [diff] [blame] | 85 | $<$<BOOL:${PLATFORM_DEFAULT_PROVISIONING}>:ext/common/provisioning.c> |
shejia01 | f0ef274 | 2022-06-06 14:24:14 +0800 | [diff] [blame] | 86 | $<$<OR:$<BOOL:${TEST_S_FPU}>,$<BOOL:${TEST_NS_FPU}>>:${CMAKE_SOURCE_DIR}/platform/ext/common/test_interrupt.c> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 87 | ) |
| 88 | |
Joakim Andersson | 4e1d40b | 2022-05-31 08:47:55 +0200 | [diff] [blame] | 89 | # If this is not added to the tfm_s it will not correctly override the weak |
| 90 | # default handlers declared in assemebly, and will instead be discarded as they |
| 91 | # are not in use. |
| 92 | target_sources(tfm_s |
| 93 | PRIVATE |
| 94 | ext/common/faults.c |
| 95 | ) |
| 96 | |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 97 | target_link_libraries(platform_s |
| 98 | PUBLIC |
Raef Coles | a8f1ddf | 2021-05-25 15:47:25 +0100 | [diff] [blame] | 99 | platform_common_interface |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 100 | platform_region_defs |
Raef Coles | 02a7600 | 2021-04-26 12:01:16 +0100 | [diff] [blame] | 101 | tfm_fih_headers |
Dávid Házi | 6f46229 | 2022-10-05 21:38:01 +0200 | [diff] [blame] | 102 | cmsis_stack_override |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 103 | PRIVATE |
| 104 | psa_interface |
Raef Coles | aefbe08 | 2021-06-18 08:53:43 +0100 | [diff] [blame] | 105 | tfm_partition_defs |
Xinyu Zhang | 6ad0703 | 2022-08-10 14:45:56 +0800 | [diff] [blame] | 106 | platform_crypto_keys |
Jamie Fox | a297bf7 | 2022-10-13 12:09:19 +0100 | [diff] [blame] | 107 | tfm_spm_defs # For tfm_spm_log.h |
Shawn Shan | 7b49b8e | 2021-10-11 17:13:23 +0800 | [diff] [blame] | 108 | $<$<BOOL:${PLATFORM_DEFAULT_ATTEST_HAL}>:tfm_sprt> |
Joakim Andersson | 15c16ab | 2022-01-20 15:06:55 +0100 | [diff] [blame] | 109 | $<$<BOOL:${TFM_PARTITION_CRYPTO}>:crypto_service_mbedcrypto> |
Raef Coles | 6e8dfd2 | 2022-07-29 12:57:47 +0100 | [diff] [blame] | 110 | $<$<BOOL:${TFM_PARTITION_INITIAL_ATTESTATION}>:tfm_attestation_defs> |
Xinyu Zhang | 6ad0703 | 2022-08-10 14:45:56 +0800 | [diff] [blame] | 111 | $<$<NOT:$<STREQUAL:${TFM_FIH_PROFILE},OFF>>:tfm_fih> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 112 | ) |
| 113 | |
| 114 | target_compile_definitions(platform_s |
Shawn Shan | 6f33aad | 2020-10-16 15:30:17 +0800 | [diff] [blame] | 115 | PUBLIC |
| 116 | TFM_SPM_LOG_LEVEL=${TFM_SPM_LOG_LEVEL} |
Joakim Andersson | d6bebe1 | 2021-12-10 10:48:50 +0100 | [diff] [blame] | 117 | $<$<BOOL:${TFM_SPM_LOG_RAW_ENABLED}>:TFM_SPM_LOG_RAW_ENABLED> |
Raef Coles | 148b947 | 2021-06-18 08:48:17 +0100 | [diff] [blame] | 118 | $<$<BOOL:${OTP_NV_COUNTERS_RAM_EMULATION}>:OTP_NV_COUNTERS_RAM_EMULATION> |
Ken Liu | 2e43489 | 2022-02-16 12:10:16 +0800 | [diff] [blame] | 119 | $<$<BOOL:${TFM_EXCEPTION_INFO_DUMP}>:TFM_EXCEPTION_INFO_DUMP> |
Jianliang Shen | ec27c23 | 2022-07-25 17:54:33 +0800 | [diff] [blame] | 120 | $<$<OR:$<VERSION_GREATER:${TFM_ISOLATION_LEVEL},1>,$<STREQUAL:"${TEST_PSA_API}","IPC">>:CONFIG_TFM_ENABLE_MEMORY_PROTECT> |
| 121 | $<$<AND:$<BOOL:${TFM_PXN_ENABLE}>,$<STREQUAL:${TFM_SYSTEM_ARCHITECTURE},armv8.1-m.main>>:TFM_PXN_ENABLE> |
Gabor Toth | 4d41411 | 2021-11-10 17:44:50 +0100 | [diff] [blame] | 122 | $<$<STREQUAL:${CONFIG_TFM_FLOAT_ABI},hard>:CONFIG_TFM_FLOAT_ABI=2> |
| 123 | $<$<STREQUAL:${CONFIG_TFM_FLOAT_ABI},soft>:CONFIG_TFM_FLOAT_ABI=0> |
Feder Liang | 5519438 | 2021-11-22 16:45:33 +0800 | [diff] [blame] | 124 | $<$<BOOL:${CONFIG_TFM_LAZY_STACKING}>:CONFIG_TFM_LAZY_STACKING> |
Gabor Toth | 4d41411 | 2021-11-10 17:44:50 +0100 | [diff] [blame] | 125 | $<$<BOOL:${CONFIG_TFM_ENABLE_CP10CP11}>:CONFIG_TFM_ENABLE_CP10CP11> |
Raef Coles | 79809c7 | 2022-03-02 13:48:20 +0000 | [diff] [blame] | 126 | $<$<BOOL:${PLATFORM_DEFAULT_CRYPTO_KEYS}>:PLATFORM_DEFAULT_CRYPTO_KEYS> |
Raef Coles | 6e775a4 | 2022-06-20 13:31:53 +0100 | [diff] [blame] | 127 | $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:PLATFORM_DEFAULT_OTP> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 128 | PRIVATE |
| 129 | $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION> |
Raef Coles | aefbe08 | 2021-06-18 08:53:43 +0100 | [diff] [blame] | 130 | $<$<BOOL:${TFM_DUMMY_PROVISIONING}>:TFM_DUMMY_PROVISIONING> |
| 131 | $<$<BOOL:${ATTEST_INCLUDE_COSE_KEY_ID}>:ATTEST_INCLUDE_COSE_KEY_ID> |
Raef Coles | 33ff153 | 2021-06-18 09:18:08 +0100 | [diff] [blame] | 132 | $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:PLATFORM_DEFAULT_NV_COUNTERS> |
Michel Jaouen | d0fd8d9 | 2021-10-14 09:22:41 +0200 | [diff] [blame] | 133 | $<$<BOOL:${PLATFORM_DEFAULT_OTP_WRITEABLE}>:OTP_WRITEABLE> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 134 | ) |
| 135 | |
Feder Liang | d4dbaa9 | 2021-09-07 15:34:46 +0800 | [diff] [blame] | 136 | target_compile_options(platform_s |
| 137 | PUBLIC |
| 138 | ${COMPILER_CP_FLAG} |
| 139 | ) |
| 140 | |
Raef Coles | 79809c7 | 2022-03-02 13:48:20 +0000 | [diff] [blame] | 141 | #========================= Platform Crypto Keys ===============================# |
| 142 | |
| 143 | |
| 144 | if(TFM_PARTITION_CRYPTO) |
| 145 | target_sources(platform_crypto_keys |
| 146 | PRIVATE |
| 147 | $<$<BOOL:${PLATFORM_DEFAULT_CRYPTO_KEYS}>:ext/common/template/crypto_keys.c> |
| 148 | ) |
| 149 | |
| 150 | target_link_libraries(platform_crypto_keys |
| 151 | PRIVATE |
| 152 | crypto_service_mbedcrypto |
| 153 | tfm_psa_rot_partition_crypto |
| 154 | platform_region_defs |
| 155 | tfm_partition_defs |
| 156 | ) |
| 157 | |
| 158 | target_include_directories(platform_crypto_keys |
| 159 | PRIVATE |
| 160 | $<$<BOOL:${PLATFORM_DEFAULT_CRYPTO_KEYS}>:${CMAKE_SOURCE_DIR}/interface/include/crypto_keys> |
Raef Coles | a5f5ea6 | 2022-06-20 12:52:07 +0100 | [diff] [blame] | 161 | ${CMAKE_BINARY_DIR}/generated/interface/include |
Raef Coles | 79809c7 | 2022-03-02 13:48:20 +0000 | [diff] [blame] | 162 | ) |
| 163 | |
| 164 | target_compile_definitions(platform_crypto_keys |
| 165 | PRIVATE |
| 166 | $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION> |
Raef Coles | 6e775a4 | 2022-06-20 13:31:53 +0100 | [diff] [blame] | 167 | $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:PLATFORM_DEFAULT_OTP> |
David Hu | 3398805 | 2022-10-26 15:34:48 +0800 | [diff] [blame] | 168 | $<$<BOOL:${TEST_S_ATTESTATION}>:TEST_S_ATTESTATION> |
| 169 | $<$<BOOL:${TEST_NS_ATTESTATION}>:TEST_NS_ATTESTATION> |
Raef Coles | 79809c7 | 2022-03-02 13:48:20 +0000 | [diff] [blame] | 170 | ) |
Jianliang Shen | 3d54219 | 2022-08-08 15:58:53 +0800 | [diff] [blame] | 171 | |
| 172 | target_compile_options(platform_crypto_keys |
| 173 | PUBLIC |
| 174 | ${COMPILER_CP_FLAG} |
| 175 | ) |
Raef Coles | 79809c7 | 2022-03-02 13:48:20 +0000 | [diff] [blame] | 176 | endif() |
| 177 | |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 178 | #========================= Platform BL2 =======================================# |
| 179 | if(BL2) |
| 180 | #TODO import policy |
| 181 | target_include_directories(platform_bl2 |
| 182 | PUBLIC |
Tamas Ban | 37aedb5 | 2020-10-01 10:54:48 +0100 | [diff] [blame] | 183 | $<$<BOOL:${CRYPTO_HW_ACCELERATOR}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/accelerator/interface> |
Raef Coles | 11c307d | 2022-09-27 08:47:08 +0100 | [diff] [blame] | 184 | ${MCUBOOT_PATH}/boot/bootutil/include |
Jamie Fox | 0dea7a1 | 2022-06-08 11:08:10 +0100 | [diff] [blame] | 185 | ${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/include |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 186 | ) |
| 187 | |
| 188 | target_sources(platform_bl2 |
| 189 | PRIVATE |
Raef Coles | 630d0b8 | 2021-04-26 11:08:43 +0100 | [diff] [blame] | 190 | ext/common/boot_hal_bl2.c |
Gabor Abonyi | 931622b | 2020-10-19 15:08:40 +0200 | [diff] [blame] | 191 | $<$<BOOL:${PLATFORM_DEFAULT_UART_STDOUT}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/common/uart_stdout.c> |
Raef Coles | 33ff153 | 2021-06-18 09:18:08 +0100 | [diff] [blame] | 192 | $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:ext/common/template/nv_counters.c> |
| 193 | $<$<BOOL:${PLATFORM_DEFAULT_ROTPK}>:ext/common/template/tfm_rotpk.c> |
Jamie Fox | 6905d0c | 2022-06-21 16:03:12 +0100 | [diff] [blame] | 194 | $<$<OR:$<AND:$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>,$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>>,$<BOOL:${PLATFORM_DEFAULT_OTP}>>:ext/common/template/flash_otp_nv_counters_backend.c> |
Raef Coles | 148b947 | 2021-06-18 08:48:17 +0100 | [diff] [blame] | 195 | $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:ext/common/template/otp_flash.c> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 196 | ) |
| 197 | |
| 198 | target_link_libraries(platform_bl2 |
| 199 | PUBLIC |
Raef Coles | a8f1ddf | 2021-05-25 15:47:25 +0100 | [diff] [blame] | 200 | platform_common_interface |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 201 | platform_region_defs |
Dávid Házi | 6f46229 | 2022-10-05 21:38:01 +0200 | [diff] [blame] | 202 | cmsis_stack_override |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 203 | PRIVATE |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 204 | bl2_hal |
Raef Coles | 2f65d12 | 2022-04-05 14:37:40 +0100 | [diff] [blame] | 205 | mcuboot_config |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 206 | ) |
| 207 | |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 208 | target_compile_definitions(platform_bl2 |
| 209 | PUBLIC |
| 210 | BL2 |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 211 | MCUBOOT_${MCUBOOT_UPGRADE_STRATEGY} |
Sherry Zhang | c4d8e2c | 2021-05-31 15:22:05 +0800 | [diff] [blame] | 212 | $<$<BOOL:${MCUBOOT_DIRECT_XIP_REVERT}>:MCUBOOT_DIRECT_XIP_REVERT> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 213 | $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION> |
| 214 | $<$<BOOL:${MCUBOOT_HW_KEY}>:MCUBOOT_HW_KEY> |
Tamas Ban | 1bfc9da | 2020-07-09 13:55:38 +0100 | [diff] [blame] | 215 | MCUBOOT_FIH_PROFILE_${MCUBOOT_FIH_PROFILE} |
Raef Coles | 148b947 | 2021-06-18 08:48:17 +0100 | [diff] [blame] | 216 | $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:PLATFORM_DEFAULT_OTP> |
| 217 | $<$<BOOL:${OTP_NV_COUNTERS_RAM_EMULATION}>:OTP_NV_COUNTERS_RAM_EMULATION> |
Raef Coles | aefbe08 | 2021-06-18 08:53:43 +0100 | [diff] [blame] | 218 | $<$<BOOL:${TFM_DUMMY_PROVISIONING}>:TFM_DUMMY_PROVISIONING> |
| 219 | $<$<BOOL:${ATTEST_INCLUDE_COSE_KEY_ID}>:ATTEST_INCLUDE_COSE_KEY_ID> |
Raef Coles | 33ff153 | 2021-06-18 09:18:08 +0100 | [diff] [blame] | 220 | $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:PLATFORM_DEFAULT_NV_COUNTERS> |
Michel Jaouen | d0fd8d9 | 2021-10-14 09:22:41 +0200 | [diff] [blame] | 221 | $<$<BOOL:${PLATFORM_DEFAULT_OTP_WRITEABLE}>:OTP_WRITEABLE> |
Satish Kumar | e945bc2 | 2021-07-31 08:26:27 +0100 | [diff] [blame] | 222 | ) |
| 223 | |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 224 | endif() |
| 225 | |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 226 | #========================= Platform BL1_1 =====================================# |
| 227 | |
| 228 | if(BL1 AND PLATFORM_DEFAULT_BL1) |
| 229 | target_include_directories(platform_bl1_interface |
| 230 | INTERFACE |
| 231 | . |
| 232 | ./include |
| 233 | ./ext/cmsis |
| 234 | ./ext/driver |
| 235 | ) |
| 236 | |
| 237 | target_link_libraries(platform_bl1_interface |
| 238 | INTERFACE |
| 239 | platform_region_defs |
| 240 | platform_common_interface |
Dávid Házi | 6f46229 | 2022-10-05 21:38:01 +0200 | [diff] [blame] | 241 | cmsis_stack_override |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 242 | ) |
| 243 | |
| 244 | target_compile_definitions(platform_bl1_interface |
| 245 | INTERFACE |
| 246 | $<$<BOOL:${CRYPTO_HW_ACCELERATOR}>:CRYPTO_HW_ACCELERATOR> |
| 247 | $<$<BOOL:${TFM_BL1_LOGGING}>:TFM_BL1_LOGGING> |
| 248 | $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:PLATFORM_DEFAULT_OTP> |
| 249 | $<$<BOOL:${OTP_NV_COUNTERS_RAM_EMULATION}>:OTP_NV_COUNTERS_RAM_EMULATION> |
| 250 | $<$<BOOL:${TFM_DUMMY_PROVISIONING}>:TFM_DUMMY_PROVISIONING> |
| 251 | $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:PLATFORM_DEFAULT_NV_COUNTERS> |
| 252 | $<$<BOOL:${PLATFORM_DEFAULT_OTP_WRITEABLE}>:OTP_WRITEABLE> |
| 253 | ) |
| 254 | |
| 255 | target_sources(platform_bl1 |
| 256 | PRIVATE |
| 257 | ./ext/common/boot_hal_bl1.c |
| 258 | ./ext/common/uart_stdout.c |
| 259 | $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:ext/common/template/nv_counters.c> |
Jamie Fox | 6905d0c | 2022-06-21 16:03:12 +0100 | [diff] [blame] | 260 | $<$<OR:$<AND:$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>,$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>>,$<BOOL:${PLATFORM_DEFAULT_OTP}>>:ext/common/template/flash_otp_nv_counters_backend.c> |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 261 | $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:ext/common/template/otp_flash.c> |
| 262 | ) |
| 263 | |
| 264 | target_link_libraries(platform_bl1 |
| 265 | PUBLIC |
| 266 | platform_bl1_interface |
| 267 | PRIVATE |
Xinyu Zhang | 6ad0703 | 2022-08-10 14:45:56 +0800 | [diff] [blame] | 268 | tfm_fih |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 269 | tfm_fih_headers |
| 270 | $<$<BOOL:${CRYPTO_HW_ACCELERATOR}>:bl1_crypto_hw> |
David Vincze | f3e492d | 2021-12-10 18:06:58 +0100 | [diff] [blame] | 271 | tfm_boot_status |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 272 | ) |
| 273 | |
| 274 | endif() |
| 275 | |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 276 | #========================= Platform region defs ===============================# |
| 277 | |
| 278 | #TODO maybe just link the other platforms to this |
| 279 | target_compile_definitions(platform_region_defs |
| 280 | INTERFACE |
Raef Coles | 12c642c | 2021-08-10 16:55:40 +0100 | [diff] [blame] | 281 | $<$<BOOL:${BL1}>:BL1> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 282 | $<$<BOOL:${BL2}>:BL2> |
Ludovic Barre | 5319ac0 | 2021-11-02 09:51:29 +0100 | [diff] [blame] | 283 | BL2_HEADER_SIZE=${BL2_HEADER_SIZE} |
Ludovic Barre | 6432c7f | 2021-11-08 11:17:33 +0100 | [diff] [blame] | 284 | BL2_TRAILER_SIZE=${BL2_TRAILER_SIZE} |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 285 | BL1_HEADER_SIZE=${BL1_HEADER_SIZE} |
| 286 | BL1_TRAILER_SIZE=${BL1_TRAILER_SIZE} |
| 287 | $<$<BOOL:${PLATFORM_DEFAULT_BL1}>:PLATFORM_DEFAULT_BL1> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 288 | $<$<BOOL:${SECURE_UART1}>:SECURE_UART1> |
| 289 | DAUTH_${DEBUG_AUTHENTICATION} |
Sherry Zhang | 5846d2b | 2021-09-30 15:34:14 +0800 | [diff] [blame] | 290 | $<$<BOOL:${MCUBOOT_IMAGE_NUMBER}>:MCUBOOT_IMAGE_NUMBER=${MCUBOOT_IMAGE_NUMBER}> |
Michel Jaouen | 4dc2442 | 2020-09-25 14:24:45 +0200 | [diff] [blame] | 291 | $<$<STREQUAL:${MCUBOOT_SIGNATURE_TYPE},RSA>:MCUBOOT_SIGN_RSA> |
| 292 | $<$<STREQUAL:${MCUBOOT_SIGNATURE_TYPE},RSA>:MCUBOOT_SIGN_RSA_LEN=${MCUBOOT_SIGNATURE_KEY_LEN}> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 293 | $<$<STREQUAL:${MCUBOOT_EXECUTION_SLOT},2>:LINK_TO_SECONDARY_PARTITION> |
Soby Mathew | 5869e4c | 2020-10-09 18:07:30 +0100 | [diff] [blame] | 294 | $<$<BOOL:${TEST_PSA_API}>:PSA_API_TEST_${TEST_PSA_API}> |
Tamas Ban | ec109ea | 2020-11-24 14:13:30 +0000 | [diff] [blame] | 295 | $<$<BOOL:${TFM_CODE_SHARING}>:CODE_SHARING> |
Sherry Zhang | e152498 | 2022-06-08 16:57:59 +0800 | [diff] [blame] | 296 | $<$<OR:$<CONFIG:Debug>,$<CONFIG:relwithdebinfo>>:ENABLE_HEAP> |
Raef Coles | 249aba9 | 2022-06-16 10:20:29 +0100 | [diff] [blame] | 297 | PLATFORM_NS_NV_COUNTERS=${TFM_NS_NV_COUNTER_AMOUNT} |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 298 | ) |