Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
chesun01 | ea11c82 | 2022-12-15 15:53:05 +0800 | [diff] [blame] | 2 | # Copyright (c) 2020-2023, 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 | |
Xinyu Zhang | 6ebef84 | 2023-05-19 14:07:27 +0800 | [diff] [blame] | 13 | add_subdirectory(ns) |
Chris Brand | db22899 | 2022-05-31 15:05:09 -0700 | [diff] [blame] | 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) |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 24 | add_library(platform_bl1_1 STATIC) |
| 25 | add_library(platform_bl1_2 STATIC) |
| 26 | add_library(platform_bl1_1_interface INTERFACE) |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 27 | endif() |
| 28 | |
Raef Coles | 79809c7 | 2022-03-02 13:48:20 +0000 | [diff] [blame] | 29 | if (TFM_PARTITION_CRYPTO) |
| 30 | add_library(platform_crypto_keys STATIC) |
| 31 | endif() |
| 32 | |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 33 | set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR}) |
| 34 | |
Øyvind Rønningstad | 1dab74b | 2020-12-01 15:26:39 +0100 | [diff] [blame] | 35 | add_subdirectory(ext/target/${TFM_PLATFORM} target) |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 36 | |
Dávid Házi | 6f46229 | 2022-10-05 21:38:01 +0200 | [diff] [blame] | 37 | #====================== CMSIS stack override interface ========================# |
| 38 | |
| 39 | # NS linker scripts using the default CMSIS style naming conventions, while the |
| 40 | # secure and bl2 linker scripts remain untouched (region.h compatibility). |
| 41 | # To be compatible with the untouched files (which using ARMCLANG naming style), |
| 42 | # we have to override __INITIAL_SP and __STACK_LIMIT labels. |
| 43 | |
Dávid Házi | d80eeb4 | 2022-10-31 21:50:58 +0100 | [diff] [blame] | 44 | 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] | 45 | add_library(cmsis_stack_override INTERFACE) |
Dávid Házi | d80eeb4 | 2022-10-31 21:50:58 +0100 | [diff] [blame] | 46 | target_compile_options(cmsis_stack_override |
Dávid Házi | 6f46229 | 2022-10-05 21:38:01 +0200 | [diff] [blame] | 47 | INTERFACE |
Dávid Házi | d80eeb4 | 2022-10-31 21:50:58 +0100 | [diff] [blame] | 48 | "$<$<C_COMPILER_ID:GNU>:SHELL:-include ${CMSIS_OVERRIDE_HEADER}>" |
| 49 | "$<$<C_COMPILER_ID:IAR>:SHELL:--preinclude ${CMSIS_OVERRIDE_HEADER}>" |
Dávid Házi | 6f46229 | 2022-10-05 21:38:01 +0200 | [diff] [blame] | 50 | ) |
| 51 | |
Raef Coles | a8f1ddf | 2021-05-25 15:47:25 +0100 | [diff] [blame] | 52 | #========================= Platform Common interface ==========================# |
| 53 | |
| 54 | target_include_directories(platform_common_interface |
| 55 | INTERFACE |
| 56 | ./ext |
| 57 | ./ext/cmsis |
| 58 | ./ext/common |
| 59 | ./ext/driver |
| 60 | ./include |
| 61 | ) |
| 62 | |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 63 | #========================= Platform Secure ====================================# |
| 64 | |
| 65 | target_include_directories(platform_s |
| 66 | PUBLIC |
Tamas Ban | 37aedb5 | 2020-10-01 10:54:48 +0100 | [diff] [blame] | 67 | $<$<BOOL:${CRYPTO_HW_ACCELERATOR}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/accelerator/interface> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 68 | ) |
| 69 | |
| 70 | target_sources(platform_s |
| 71 | PRIVATE |
Mark Horvath | b9ac0d5 | 2020-09-09 10:48:22 +0200 | [diff] [blame] | 72 | $<$<BOOL:${TFM_PARTITION_PROTECTED_STORAGE}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/common/tfm_hal_ps.c> |
| 73 | $<$<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] | 74 | $<$<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] | 75 | $<$<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] | 76 | $<$<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] | 77 | $<$<BOOL:${TFM_EXCEPTION_INFO_DUMP}>:ext/common/exception_info.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 |
Xinyu Zhang | eeb19ac | 2023-06-19 18:09:20 +0800 | [diff] [blame] | 105 | tfm_config |
Jamie Fox | a297bf7 | 2022-10-13 12:09:19 +0100 | [diff] [blame] | 106 | tfm_spm_defs # For tfm_spm_log.h |
Anton Komlev | a07180c | 2022-10-24 23:53:47 +0100 | [diff] [blame] | 107 | $<$<BOOL:${TFM_PARTITION_CRYPTO}>:platform_crypto_keys> |
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> |
Andrej Butok | 302da63 | 2023-07-14 12:57:08 +0200 | [diff] [blame] | 118 | $<$<BOOL:${OTP_NV_COUNTERS_RAM_EMULATION}>:OTP_NV_COUNTERS_RAM_EMULATION=1> |
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> |
Jianliang Shen | d90aa0c | 2023-03-14 15:02:10 +0800 | [diff] [blame] | 121 | $<$<BOOL:${TFM_PXN_ENABLE}>: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> |
Arnold Gabriel Benedict | eabe99a | 2023-02-01 09:30:36 +0000 | [diff] [blame] | 128 | $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:PLATFORM_DEFAULT_NV_COUNTERS> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 129 | PRIVATE |
| 130 | $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION> |
Raef Coles | aefbe08 | 2021-06-18 08:53:43 +0100 | [diff] [blame] | 131 | $<$<BOOL:${TFM_DUMMY_PROVISIONING}>:TFM_DUMMY_PROVISIONING> |
Michel Jaouen | d0fd8d9 | 2021-10-14 09:22:41 +0200 | [diff] [blame] | 132 | $<$<BOOL:${PLATFORM_DEFAULT_OTP_WRITEABLE}>:OTP_WRITEABLE> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 133 | ) |
| 134 | |
Feder Liang | d4dbaa9 | 2021-09-07 15:34:46 +0800 | [diff] [blame] | 135 | target_compile_options(platform_s |
| 136 | PUBLIC |
| 137 | ${COMPILER_CP_FLAG} |
| 138 | ) |
| 139 | |
Raef Coles | 79809c7 | 2022-03-02 13:48:20 +0000 | [diff] [blame] | 140 | #========================= Platform Crypto Keys ===============================# |
| 141 | |
| 142 | |
| 143 | if(TFM_PARTITION_CRYPTO) |
| 144 | target_sources(platform_crypto_keys |
| 145 | PRIVATE |
| 146 | $<$<BOOL:${PLATFORM_DEFAULT_CRYPTO_KEYS}>:ext/common/template/crypto_keys.c> |
| 147 | ) |
| 148 | |
| 149 | target_link_libraries(platform_crypto_keys |
| 150 | PRIVATE |
| 151 | crypto_service_mbedcrypto |
| 152 | tfm_psa_rot_partition_crypto |
| 153 | platform_region_defs |
Xinyu Zhang | eeb19ac | 2023-06-19 18:09:20 +0800 | [diff] [blame] | 154 | tfm_config |
Raef Coles | 79809c7 | 2022-03-02 13:48:20 +0000 | [diff] [blame] | 155 | ) |
| 156 | |
| 157 | target_include_directories(platform_crypto_keys |
| 158 | PRIVATE |
| 159 | $<$<BOOL:${PLATFORM_DEFAULT_CRYPTO_KEYS}>:${CMAKE_SOURCE_DIR}/interface/include/crypto_keys> |
Raef Coles | a5f5ea6 | 2022-06-20 12:52:07 +0100 | [diff] [blame] | 160 | ${CMAKE_BINARY_DIR}/generated/interface/include |
Raef Coles | 79809c7 | 2022-03-02 13:48:20 +0000 | [diff] [blame] | 161 | ) |
| 162 | |
| 163 | target_compile_definitions(platform_crypto_keys |
| 164 | PRIVATE |
Raef Coles | f30c17f | 2023-04-25 09:55:46 +0100 | [diff] [blame] | 165 | MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER |
Raef Coles | 79809c7 | 2022-03-02 13:48:20 +0000 | [diff] [blame] | 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> |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 194 | $<$<OR:$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>,$<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 |
Jamie Fox | dd7e55f | 2023-08-01 17:56:39 +0100 | [diff] [blame] | 206 | $<$<AND:$<BOOL:${CONFIG_TFM_BOOT_STORE_MEASUREMENTS}>,$<NOT:$<BOOL:${CONFIG_TFM_BOOT_STORE_ENCODED_MEASUREMENTS}>>>:tfm_boot_status> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 207 | ) |
| 208 | |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 209 | target_compile_definitions(platform_bl2 |
| 210 | PUBLIC |
| 211 | BL2 |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 212 | MCUBOOT_${MCUBOOT_UPGRADE_STRATEGY} |
Sherry Zhang | c4d8e2c | 2021-05-31 15:22:05 +0800 | [diff] [blame] | 213 | $<$<BOOL:${MCUBOOT_DIRECT_XIP_REVERT}>:MCUBOOT_DIRECT_XIP_REVERT> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 214 | $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION> |
| 215 | $<$<BOOL:${MCUBOOT_HW_KEY}>:MCUBOOT_HW_KEY> |
Tamas Ban | 1bfc9da | 2020-07-09 13:55:38 +0100 | [diff] [blame] | 216 | MCUBOOT_FIH_PROFILE_${MCUBOOT_FIH_PROFILE} |
Raef Coles | 148b947 | 2021-06-18 08:48:17 +0100 | [diff] [blame] | 217 | $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:PLATFORM_DEFAULT_OTP> |
Andrej Butok | 302da63 | 2023-07-14 12:57:08 +0200 | [diff] [blame] | 218 | $<$<BOOL:${OTP_NV_COUNTERS_RAM_EMULATION}>:OTP_NV_COUNTERS_RAM_EMULATION=1> |
Raef Coles | aefbe08 | 2021-06-18 08:53:43 +0100 | [diff] [blame] | 219 | $<$<BOOL:${TFM_DUMMY_PROVISIONING}>:TFM_DUMMY_PROVISIONING> |
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> |
Jamie Fox | dd7e55f | 2023-08-01 17:56:39 +0100 | [diff] [blame] | 222 | $<$<AND:$<BOOL:${CONFIG_TFM_BOOT_STORE_MEASUREMENTS}>,$<NOT:$<BOOL:${CONFIG_TFM_BOOT_STORE_ENCODED_MEASUREMENTS}>>>:TFM_MEASURED_BOOT_API> |
Satish Kumar | e945bc2 | 2021-07-31 08:26:27 +0100 | [diff] [blame] | 223 | ) |
| 224 | |
chesun01 | ea11c82 | 2022-12-15 15:53:05 +0800 | [diff] [blame] | 225 | target_compile_options(platform_bl2 |
| 226 | PUBLIC |
| 227 | ${BL2_COMPILER_CP_FLAG} |
| 228 | ) |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 229 | endif() |
| 230 | |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 231 | #========================= Platform BL1_1 =====================================# |
| 232 | |
| 233 | if(BL1 AND PLATFORM_DEFAULT_BL1) |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 234 | target_include_directories(platform_bl1_1_interface |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 235 | INTERFACE |
| 236 | . |
| 237 | ./include |
| 238 | ./ext/cmsis |
| 239 | ./ext/driver |
| 240 | ) |
| 241 | |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 242 | target_link_libraries(platform_bl1_1_interface |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 243 | INTERFACE |
| 244 | platform_region_defs |
| 245 | platform_common_interface |
Dávid Házi | 6f46229 | 2022-10-05 21:38:01 +0200 | [diff] [blame] | 246 | cmsis_stack_override |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 247 | ) |
| 248 | |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 249 | target_compile_definitions(platform_bl1_1_interface |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 250 | INTERFACE |
| 251 | $<$<BOOL:${CRYPTO_HW_ACCELERATOR}>:CRYPTO_HW_ACCELERATOR> |
| 252 | $<$<BOOL:${TFM_BL1_LOGGING}>:TFM_BL1_LOGGING> |
| 253 | $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:PLATFORM_DEFAULT_OTP> |
Andrej Butok | 302da63 | 2023-07-14 12:57:08 +0200 | [diff] [blame] | 254 | $<$<BOOL:${OTP_NV_COUNTERS_RAM_EMULATION}>:OTP_NV_COUNTERS_RAM_EMULATION=1> |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 255 | $<$<BOOL:${TFM_DUMMY_PROVISIONING}>:TFM_DUMMY_PROVISIONING> |
| 256 | $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:PLATFORM_DEFAULT_NV_COUNTERS> |
| 257 | $<$<BOOL:${PLATFORM_DEFAULT_OTP_WRITEABLE}>:OTP_WRITEABLE> |
Raef Coles | df86dbd | 2022-11-10 15:43:27 +0000 | [diff] [blame] | 258 | $<$<BOOL:${TFM_BL1_MEMORY_MAPPED_FLASH}>:TFM_BL1_MEMORY_MAPPED_FLASH> |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 259 | $<$<BOOL:${TFM_BL1_2_IN_OTP}>:TFM_BL1_2_IN_OTP> |
Jamie Fox | dd7e55f | 2023-08-01 17:56:39 +0100 | [diff] [blame] | 260 | $<$<AND:$<BOOL:${CONFIG_TFM_BOOT_STORE_MEASUREMENTS}>,$<NOT:$<BOOL:${CONFIG_TFM_BOOT_STORE_ENCODED_MEASUREMENTS}>>>:TFM_MEASURED_BOOT_API> |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 261 | ) |
| 262 | |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 263 | target_sources(platform_bl1_1 |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 264 | PRIVATE |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 265 | ./ext/common/boot_hal_bl1_1.c |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 266 | ./ext/common/uart_stdout.c |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 267 | $<$<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] | 268 | $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:ext/common/template/otp_flash.c> |
| 269 | ) |
| 270 | |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 271 | target_link_libraries(platform_bl1_1 |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 272 | PUBLIC |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 273 | platform_bl1_1_interface |
| 274 | platform_region_defs |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 275 | PRIVATE |
Xinyu Zhang | 6ad0703 | 2022-08-10 14:45:56 +0800 | [diff] [blame] | 276 | tfm_fih |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 277 | tfm_fih_headers |
David Vincze | f3e492d | 2021-12-10 18:06:58 +0100 | [diff] [blame] | 278 | tfm_boot_status |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 279 | ) |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 280 | endif() |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 281 | |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 282 | #========================= Platform BL1_2 =====================================# |
| 283 | |
| 284 | if(BL1 AND PLATFORM_DEFAULT_BL1) |
| 285 | target_include_directories(platform_bl1_2 |
| 286 | PRIVATE |
| 287 | . |
| 288 | ./include |
| 289 | ./ext/cmsis |
| 290 | ./ext/driver |
| 291 | ) |
| 292 | |
| 293 | target_link_libraries(platform_bl1_2 |
| 294 | INTERFACE |
| 295 | platform_region_defs |
| 296 | platform_common_interface |
| 297 | cmsis_stack_override |
| 298 | ) |
| 299 | |
| 300 | target_compile_definitions(platform_bl1_2 |
| 301 | INTERFACE |
| 302 | $<$<BOOL:${CRYPTO_HW_ACCELERATOR}>:CRYPTO_HW_ACCELERATOR> |
| 303 | $<$<BOOL:${TFM_BL1_LOGGING}>:TFM_BL1_LOGGING> |
| 304 | $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:PLATFORM_DEFAULT_OTP> |
Andrej Butok | 302da63 | 2023-07-14 12:57:08 +0200 | [diff] [blame] | 305 | $<$<BOOL:${OTP_NV_COUNTERS_RAM_EMULATION}>:OTP_NV_COUNTERS_RAM_EMULATION=1> |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 306 | $<$<BOOL:${TFM_DUMMY_PROVISIONING}>:TFM_DUMMY_PROVISIONING> |
| 307 | $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:PLATFORM_DEFAULT_NV_COUNTERS> |
| 308 | $<$<BOOL:${PLATFORM_DEFAULT_OTP_WRITEABLE}>:OTP_WRITEABLE> |
| 309 | $<$<BOOL:${TFM_BL1_MEMORY_MAPPED_FLASH}>:TFM_BL1_MEMORY_MAPPED_FLASH> |
| 310 | $<$<BOOL:${TFM_BL1_2_IN_OTP}>:TFM_BL1_2_IN_OTP> |
Jamie Fox | dd7e55f | 2023-08-01 17:56:39 +0100 | [diff] [blame] | 311 | $<$<AND:$<BOOL:${CONFIG_TFM_BOOT_STORE_MEASUREMENTS}>,$<NOT:$<BOOL:${CONFIG_TFM_BOOT_STORE_ENCODED_MEASUREMENTS}>>>:TFM_MEASURED_BOOT_API> |
Raef Coles | 4874aa6 | 2023-04-05 10:40:12 +0100 | [diff] [blame] | 312 | ) |
| 313 | |
| 314 | target_sources(platform_bl1_2 |
| 315 | PRIVATE |
| 316 | ./ext/common/boot_hal_bl1_2.c |
| 317 | $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:ext/common/template/nv_counters.c> |
| 318 | $<$<OR:$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>,$<BOOL:${PLATFORM_DEFAULT_OTP}>>:ext/common/template/flash_otp_nv_counters_backend.c> |
| 319 | $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:ext/common/template/otp_flash.c> |
| 320 | ) |
| 321 | |
| 322 | target_link_libraries(platform_bl1_2 |
| 323 | PUBLIC |
| 324 | platform_bl1_1_interface |
| 325 | PRIVATE |
| 326 | tfm_fih |
| 327 | tfm_fih_headers |
| 328 | tfm_boot_status |
| 329 | platform_region_defs |
| 330 | bl1_1_shared_lib_interface |
| 331 | ) |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 332 | endif() |
| 333 | |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 334 | #========================= Platform region defs ===============================# |
| 335 | |
| 336 | #TODO maybe just link the other platforms to this |
| 337 | target_compile_definitions(platform_region_defs |
| 338 | INTERFACE |
Raef Coles | 12c642c | 2021-08-10 16:55:40 +0100 | [diff] [blame] | 339 | $<$<BOOL:${BL1}>:BL1> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 340 | $<$<BOOL:${BL2}>:BL2> |
Ludovic Barre | 5319ac0 | 2021-11-02 09:51:29 +0100 | [diff] [blame] | 341 | BL2_HEADER_SIZE=${BL2_HEADER_SIZE} |
Ludovic Barre | 6432c7f | 2021-11-08 11:17:33 +0100 | [diff] [blame] | 342 | BL2_TRAILER_SIZE=${BL2_TRAILER_SIZE} |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 343 | BL1_HEADER_SIZE=${BL1_HEADER_SIZE} |
| 344 | BL1_TRAILER_SIZE=${BL1_TRAILER_SIZE} |
| 345 | $<$<BOOL:${PLATFORM_DEFAULT_BL1}>:PLATFORM_DEFAULT_BL1> |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 346 | $<$<BOOL:${SECURE_UART1}>:SECURE_UART1> |
| 347 | DAUTH_${DEBUG_AUTHENTICATION} |
Sherry Zhang | 5846d2b | 2021-09-30 15:34:14 +0800 | [diff] [blame] | 348 | $<$<BOOL:${MCUBOOT_IMAGE_NUMBER}>:MCUBOOT_IMAGE_NUMBER=${MCUBOOT_IMAGE_NUMBER}> |
Michel Jaouen | 4dc2442 | 2020-09-25 14:24:45 +0200 | [diff] [blame] | 349 | $<$<STREQUAL:${MCUBOOT_SIGNATURE_TYPE},RSA>:MCUBOOT_SIGN_RSA> |
| 350 | $<$<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] | 351 | $<$<STREQUAL:${MCUBOOT_EXECUTION_SLOT},2>:LINK_TO_SECONDARY_PARTITION> |
Soby Mathew | 5869e4c | 2020-10-09 18:07:30 +0100 | [diff] [blame] | 352 | $<$<BOOL:${TEST_PSA_API}>:PSA_API_TEST_${TEST_PSA_API}> |
Tamas Ban | ec109ea | 2020-11-24 14:13:30 +0000 | [diff] [blame] | 353 | $<$<BOOL:${TFM_CODE_SHARING}>:CODE_SHARING> |
Sherry Zhang | e152498 | 2022-06-08 16:57:59 +0800 | [diff] [blame] | 354 | $<$<OR:$<CONFIG:Debug>,$<CONFIG:relwithdebinfo>>:ENABLE_HEAP> |
Raef Coles | 249aba9 | 2022-06-16 10:20:29 +0100 | [diff] [blame] | 355 | PLATFORM_NS_NV_COUNTERS=${TFM_NS_NV_COUNTER_AMOUNT} |
Raef Coles | 1cb0ecc | 2020-07-10 09:56:01 +0100 | [diff] [blame] | 356 | ) |
Chris Brand | b9df7b6 | 2022-10-31 11:53:29 -0700 | [diff] [blame] | 357 | |
| 358 | target_include_directories(platform_region_defs |
| 359 | INTERFACE |
| 360 | ${CMAKE_CURRENT_LIST_DIR}/ext/common |
| 361 | ) |
Gabor Toth | fceea76 | 2022-11-08 16:38:02 +0100 | [diff] [blame] | 362 | |
| 363 | target_link_libraries(platform_region_defs |
| 364 | INTERFACE |
| 365 | tfm_config |
| 366 | ) |