1#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2024, Arm Limited. All rights reserved.
3# Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company)
4# or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
5#
6# SPDX-License-Identifier: BSD-3-Clause
7#
8#-------------------------------------------------------------------------------
9cmake_minimum_required(VERSION 3.21)
10
11add_library(platform_s STATIC)
12add_library(platform_region_defs INTERFACE)
13add_library(platform_common_interface INTERFACE)
14
15if (BL2)
16    add_library(platform_bl2 STATIC)
17endif()
18
19if (BL1 AND PLATFORM_DEFAULT_BL1)
20    add_library(platform_bl1_1 STATIC)
21    add_library(platform_bl1_2 STATIC)
22    add_library(platform_bl1_1_interface INTERFACE)
23endif()
24
25if (TFM_PARTITION_CRYPTO)
26    add_library(platform_crypto_keys STATIC)
27endif()
28
29set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR} CACHE PATH "Path to platform directory")
30
31# Skip "up-to-date" prints to avoid flooding the build output. Just print "installing"
32set(CMAKE_INSTALL_MESSAGE LAZY)
33
34add_subdirectory(ext/target/${TFM_PLATFORM} target)
35
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
43set(CMSIS_OVERRIDE_HEADER "${CMAKE_CURRENT_LIST_DIR}/include/cmsis_override.h")
44add_library(cmsis_stack_override INTERFACE)
45target_compile_options(cmsis_stack_override
46    INTERFACE
47        "$<$<C_COMPILER_ID:GNU>:SHELL:-include ${CMSIS_OVERRIDE_HEADER}>"
48        "$<$<C_COMPILER_ID:IAR>:SHELL:--preinclude ${CMSIS_OVERRIDE_HEADER}>"
49)
50
51#========================= Platform Common interface ==========================#
52
53target_include_directories(platform_common_interface
54    INTERFACE
55        ext
56        ext/common
57        ext/driver
58        include
59)
60
61#========================= Platform Secure ====================================#
62
63target_include_directories(platform_s
64    PUBLIC
65        $<$<BOOL:${CRYPTO_HW_ACCELERATOR}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/accelerator/interface>
66        ../secure_fw/spm/include/private
67)
68
69target_sources(platform_s
70    PRIVATE
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>
73        $<$<BOOL:${PLATFORM_DEFAULT_SYSTEM_RESET_HALT}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/common/tfm_hal_reset_halt.c>
74        $<$<BOOL:${PLATFORM_DEFAULT_UART_STDOUT}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/common/uart_stdout.c>
75        $<$<BOOL:${TFM_SPM_LOG_RAW_ENABLED}>:ext/common/tfm_hal_spm_logdev_peripheral.c>
76        $<$<BOOL:${TFM_EXCEPTION_INFO_DUMP}>:ext/common/exception_info.c>
77        $<$<BOOL:${PLATFORM_DEFAULT_ATTEST_HAL}>:ext/common/template/attest_hal.c>
78        $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:ext/common/template/nv_counters.c>
79        $<$<BOOL:${PLATFORM_DEFAULT_ROTPK}>:ext/common/template/tfm_rotpk.c>
80        $<$<BOOL:${PLATFORM_DEFAULT_NV_SEED}>:ext/common/template/crypto_nv_seed.c>
81        $<$<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>
82        $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:ext/common/template/otp_flash.c>
83        $<$<BOOL:${PLATFORM_DEFAULT_PROVISIONING}>:ext/common/provisioning.c>
84        $<$<OR:$<BOOL:${TEST_S_FPU}>,$<BOOL:${TEST_NS_FPU}>>:${CMAKE_SOURCE_DIR}/platform/ext/common/test_interrupt.c>
85        $<$<BOOL:${TFM_SANITIZE}>:ext/common/tfm_sanitize_handlers.c>
86        ./ext/common/tfm_fatal_error.c
87)
88
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.
92target_sources(tfm_s
93    PRIVATE
94        ext/common/faults.c
95)
96
97target_link_libraries(platform_s
98    PUBLIC
99        platform_common_interface
100        platform_region_defs
101        tfm_fih_headers
102        cmsis_stack_override
103        cmsis
104    PRIVATE
105        tfm_config
106        tfm_spm_defs # For tfm_spm_log.h
107        $<$<BOOL:${TFM_PARTITION_CRYPTO}>:platform_crypto_keys>
108        $<$<BOOL:${PLATFORM_DEFAULT_ATTEST_HAL}>:tfm_sprt>
109        $<$<BOOL:${TFM_PARTITION_CRYPTO}>:crypto_service_mbedcrypto>
110        $<$<BOOL:${TFM_PARTITION_INITIAL_ATTESTATION}>:tfm_attestation_defs>
111        $<$<NOT:$<STREQUAL:${TFM_FIH_PROFILE},OFF>>:tfm_fih>
112        psa_crypto_library_config
113)
114
115target_compile_definitions(platform_s
116    PUBLIC
117        TFM_SPM_LOG_LEVEL=${TFM_SPM_LOG_LEVEL}
118        $<$<BOOL:${TFM_SPM_LOG_RAW_ENABLED}>:TFM_SPM_LOG_RAW_ENABLED>
119        $<$<BOOL:${OTP_NV_COUNTERS_RAM_EMULATION}>:OTP_NV_COUNTERS_RAM_EMULATION=1>
120        $<$<BOOL:${TFM_EXCEPTION_INFO_DUMP}>:TFM_EXCEPTION_INFO_DUMP>
121        $<$<OR:$<VERSION_GREATER:${TFM_ISOLATION_LEVEL},1>,$<STREQUAL:"${TEST_PSA_API}","IPC">>:CONFIG_TFM_ENABLE_MEMORY_PROTECT>
122        $<$<BOOL:${TFM_PXN_ENABLE}>:TFM_PXN_ENABLE>
123        $<$<STREQUAL:${CONFIG_TFM_FLOAT_ABI},hard>:CONFIG_TFM_FLOAT_ABI=2>
124        $<$<STREQUAL:${CONFIG_TFM_FLOAT_ABI},soft>:CONFIG_TFM_FLOAT_ABI=0>
125        $<$<BOOL:${CONFIG_TFM_LAZY_STACKING}>:CONFIG_TFM_LAZY_STACKING>
126        $<$<BOOL:${CONFIG_TFM_ENABLE_CP10CP11}>:CONFIG_TFM_ENABLE_CP10CP11>
127        $<$<BOOL:${PLATFORM_DEFAULT_CRYPTO_KEYS}>:PLATFORM_DEFAULT_CRYPTO_KEYS>
128        $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:PLATFORM_DEFAULT_OTP>
129        $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:PLATFORM_DEFAULT_NV_COUNTERS>
130        $<$<AND:$<BOOL:${TFM_LOG_FATAL_ERRORS}>,$<NOT:$<STREQUAL:${TFM_SPM_LOG_LEVEL},"TFM_SPM_LOG_LEVEL_SILENCE">>>:LOG_FATAL_ERRORS>
131        $<$<AND:$<BOOL:${TFM_LOG_NONFATAL_ERRORS}>,$<NOT:$<STREQUAL:${TFM_SPM_LOG_LEVEL},"TFM_SPM_LOG_LEVEL_SILENCE">>>:LOG_NONFATAL_ERRORS>
132    PRIVATE
133        $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
134        $<$<BOOL:${TFM_DUMMY_PROVISIONING}>:TFM_DUMMY_PROVISIONING>
135        $<$<BOOL:${PLATFORM_DEFAULT_OTP_WRITEABLE}>:OTP_WRITEABLE>
136)
137
138target_compile_options(platform_s
139    PUBLIC
140        ${COMPILER_CP_FLAG}
141        $<$<BOOL:${TFM_SANITIZE}>:-fsanitize=${TFM_SANITIZE}>
142)
143
144#========================= Platform Crypto Keys ===============================#
145
146
147if(TFM_PARTITION_CRYPTO)
148    target_sources(platform_crypto_keys
149        PRIVATE
150            $<$<BOOL:${PLATFORM_DEFAULT_CRYPTO_KEYS}>:ext/common/template/crypto_keys.c>
151    )
152
153    target_link_libraries(platform_crypto_keys
154        PRIVATE
155            crypto_service_mbedcrypto
156            tfm_psa_rot_partition_crypto
157            platform_region_defs
158            tfm_config
159    )
160
161    target_include_directories(platform_crypto_keys
162        PRIVATE
163            $<$<BOOL:${PLATFORM_DEFAULT_CRYPTO_KEYS}>:${CMAKE_SOURCE_DIR}/interface/include/crypto_keys>
164            ${CMAKE_BINARY_DIR}/generated/interface/include
165    )
166
167    target_compile_definitions(platform_crypto_keys
168        PRIVATE
169            $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
170            $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:PLATFORM_DEFAULT_OTP>
171            $<$<BOOL:${TEST_S_ATTESTATION}>:TEST_S_ATTESTATION>
172            $<$<BOOL:${TEST_NS_ATTESTATION}>:TEST_NS_ATTESTATION>
173    )
174
175    target_compile_options(platform_crypto_keys
176        PUBLIC
177            ${COMPILER_CP_FLAG}
178    )
179endif()
180
181#========================= Platform BL2 =======================================#
182if(BL2)
183    #TODO import policy
184    target_include_directories(platform_bl2
185        PUBLIC
186            $<$<BOOL:${CRYPTO_HW_ACCELERATOR}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/accelerator/interface>
187            ${MCUBOOT_PATH}/boot/bootutil/include
188            ${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/include
189    )
190
191    target_sources(platform_bl2
192        PRIVATE
193            ext/common/boot_hal_bl2.c
194            $<$<BOOL:${PLATFORM_DEFAULT_UART_STDOUT}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/common/uart_stdout.c>
195            $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:ext/common/template/nv_counters.c>
196            $<$<BOOL:${PLATFORM_DEFAULT_ROTPK}>:ext/common/template/tfm_rotpk.c>
197            $<$<OR:$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>,$<BOOL:${PLATFORM_DEFAULT_OTP}>>:ext/common/template/flash_otp_nv_counters_backend.c>
198            $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:ext/common/template/otp_flash.c>
199            $<$<BOOL:${BL2_SANITIZE}>:ext/common/tfm_sanitize_handlers.c>
200            ./ext/common/tfm_fatal_error.c
201    )
202
203    target_link_libraries(platform_bl2
204        PUBLIC
205            platform_common_interface
206            platform_region_defs
207            cmsis_stack_override
208            cmsis
209        PRIVATE
210            bl2_hal
211            mcuboot_config
212            $<$<AND:$<BOOL:${CONFIG_TFM_BOOT_STORE_MEASUREMENTS}>,$<NOT:$<BOOL:${CONFIG_TFM_BOOT_STORE_ENCODED_MEASUREMENTS}>>>:tfm_boot_status>
213    )
214
215    target_compile_definitions(platform_bl2
216        PUBLIC
217            BL2
218            MCUBOOT_${MCUBOOT_UPGRADE_STRATEGY}
219            $<$<BOOL:${MCUBOOT_DIRECT_XIP_REVERT}>:MCUBOOT_DIRECT_XIP_REVERT>
220            $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
221            $<$<BOOL:${MCUBOOT_HW_KEY}>:MCUBOOT_HW_KEY>
222            MCUBOOT_FIH_PROFILE_${MCUBOOT_FIH_PROFILE}
223            $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:PLATFORM_DEFAULT_OTP>
224            $<$<BOOL:${OTP_NV_COUNTERS_RAM_EMULATION}>:OTP_NV_COUNTERS_RAM_EMULATION=1>
225            $<$<BOOL:${TFM_DUMMY_PROVISIONING}>:TFM_DUMMY_PROVISIONING>
226            $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:PLATFORM_DEFAULT_NV_COUNTERS>
227            $<$<BOOL:${PLATFORM_DEFAULT_OTP_WRITEABLE}>:OTP_WRITEABLE>
228            $<$<AND:$<BOOL:${CONFIG_TFM_BOOT_STORE_MEASUREMENTS}>,$<NOT:$<BOOL:${CONFIG_TFM_BOOT_STORE_ENCODED_MEASUREMENTS}>>>:TFM_MEASURED_BOOT_API>
229            $<$<AND:$<BOOL:${TFM_LOG_FATAL_ERRORS}>,$<BOOL:${MCUBOOT_LOG_LEVEL}>>:LOG_FATAL_ERRORS>
230            $<$<AND:$<BOOL:${TFM_LOG_NONFATAL_ERRORS}>,$<BOOL:${MCUBOOT_LOG_LEVEL}>>:LOG_NONFATAL_ERRORS>
231    )
232
233    target_compile_options(platform_bl2
234        PUBLIC
235            ${BL2_COMPILER_CP_FLAG}
236            $<$<BOOL:${BL2_SANITIZE}>:-fsanitize=${BL2_SANITIZE}>
237    )
238endif()
239
240#========================= Platform BL1_1 =====================================#
241
242if(BL1 AND PLATFORM_DEFAULT_BL1)
243    target_include_directories(platform_bl1_1_interface
244        INTERFACE
245            .
246            include
247            ext/driver
248    )
249
250    target_link_libraries(platform_bl1_1_interface
251        INTERFACE
252            platform_region_defs
253            platform_common_interface
254            cmsis_stack_override
255            cmsis
256    )
257
258    target_compile_definitions(platform_bl1_1_interface
259        INTERFACE
260            $<$<BOOL:${CRYPTO_HW_ACCELERATOR}>:CRYPTO_HW_ACCELERATOR>
261            $<$<BOOL:${TFM_BL1_LOGGING}>:TFM_BL1_LOGGING>
262            $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:PLATFORM_DEFAULT_OTP>
263            $<$<BOOL:${OTP_NV_COUNTERS_RAM_EMULATION}>:OTP_NV_COUNTERS_RAM_EMULATION=1>
264            $<$<BOOL:${TFM_DUMMY_PROVISIONING}>:TFM_DUMMY_PROVISIONING>
265            $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:PLATFORM_DEFAULT_NV_COUNTERS>
266            $<$<BOOL:${PLATFORM_DEFAULT_OTP_WRITEABLE}>:OTP_WRITEABLE>
267            $<$<BOOL:${TFM_BL1_MEMORY_MAPPED_FLASH}>:TFM_BL1_MEMORY_MAPPED_FLASH>
268            $<$<BOOL:${TFM_BL1_2_IN_OTP}>:TFM_BL1_2_IN_OTP>
269            $<$<AND:$<BOOL:${CONFIG_TFM_BOOT_STORE_MEASUREMENTS}>,$<NOT:$<BOOL:${CONFIG_TFM_BOOT_STORE_ENCODED_MEASUREMENTS}>>>:TFM_MEASURED_BOOT_API>
270            $<$<AND:$<BOOL:${TFM_LOG_FATAL_ERRORS}>,$<BOOL:${TFM_BL1_LOGGING}>>:LOG_FATAL_ERRORS>
271            $<$<AND:$<BOOL:${TFM_LOG_NONFATAL_ERRORS}>,$<BOOL:${TFM_BL1_LOGGING}>>:LOG_NONFATAL_ERRORS>
272    )
273
274    target_compile_options(platform_bl1_1
275        PUBLIC
276            $<$<BOOL:${BL1_1_SANITIZE}>:-fsanitize=${BL1_1_SANITIZE}>
277            ${BL1_COMPILER_CP_FLAG}
278    )
279
280    target_link_options(platform_bl1_1
281        PUBLIC
282            ${BL1_LINKER_CP_OPTION}
283    )
284
285    target_sources(platform_bl1_1
286        PRIVATE
287            ext/common/boot_hal_bl1_1.c
288            ext/common/uart_stdout.c
289            $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:ext/common/template/flash_otp_nv_counters_backend.c>
290            $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:ext/common/template/otp_flash.c>
291            $<$<OR:$<BOOL:${BL1_1_SANITIZE}>,$<BOOL:${TFM_BL1_2_SANITIZE}>>:ext/common/tfm_sanitize_handlers.c>
292            ./ext/common/tfm_fatal_error.c
293    )
294
295    target_link_libraries(platform_bl1_1
296        PUBLIC
297            platform_bl1_1_interface
298            platform_region_defs
299        PRIVATE
300            tfm_fih
301            tfm_fih_headers
302            tfm_boot_status
303    )
304endif()
305
306#========================= Platform BL1_2 =====================================#
307
308if(BL1 AND PLATFORM_DEFAULT_BL1)
309    target_include_directories(platform_bl1_2
310        PRIVATE
311            .
312            include
313            ext/driver
314    )
315
316    target_link_libraries(platform_bl1_2
317        INTERFACE
318            platform_region_defs
319            platform_common_interface
320            cmsis_stack_override
321            cmsis
322    )
323
324    target_compile_definitions(platform_bl1_2
325        INTERFACE
326            $<$<BOOL:${CRYPTO_HW_ACCELERATOR}>:CRYPTO_HW_ACCELERATOR>
327            $<$<BOOL:${TFM_BL1_LOGGING}>:TFM_BL1_LOGGING>
328            $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:PLATFORM_DEFAULT_OTP>
329            $<$<BOOL:${OTP_NV_COUNTERS_RAM_EMULATION}>:OTP_NV_COUNTERS_RAM_EMULATION=1>
330            $<$<BOOL:${TFM_DUMMY_PROVISIONING}>:TFM_DUMMY_PROVISIONING>
331            $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:PLATFORM_DEFAULT_NV_COUNTERS>
332            $<$<BOOL:${PLATFORM_DEFAULT_OTP_WRITEABLE}>:OTP_WRITEABLE>
333            $<$<BOOL:${TFM_BL1_MEMORY_MAPPED_FLASH}>:TFM_BL1_MEMORY_MAPPED_FLASH>
334            $<$<BOOL:${TFM_BL1_2_IN_OTP}>:TFM_BL1_2_IN_OTP>
335            $<$<AND:$<BOOL:${CONFIG_TFM_BOOT_STORE_MEASUREMENTS}>,$<NOT:$<BOOL:${CONFIG_TFM_BOOT_STORE_ENCODED_MEASUREMENTS}>>>:TFM_MEASURED_BOOT_API>
336            $<$<AND:$<BOOL:${TFM_LOG_FATAL_ERRORS}>,$<BOOL:${TFM_BL1_LOGGING}>>:LOG_FATAL_ERRORS>
337            $<$<AND:$<BOOL:${TFM_LOG_NONFATAL_ERRORS}>,$<BOOL:${TFM_BL1_LOGGING}>>:LOG_NONFATAL_ERRORS>
338    )
339
340    target_sources(platform_bl1_2
341        PRIVATE
342            ext/common/boot_hal_bl1_2.c
343            $<$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>:ext/common/template/nv_counters.c>
344            $<$<OR:$<BOOL:${PLATFORM_DEFAULT_NV_COUNTERS}>,$<BOOL:${PLATFORM_DEFAULT_OTP}>>:ext/common/template/flash_otp_nv_counters_backend.c>
345            $<$<BOOL:${PLATFORM_DEFAULT_OTP}>:ext/common/template/otp_flash.c>
346    )
347
348    target_link_libraries(platform_bl1_2
349        PUBLIC
350            platform_bl1_1_interface
351        PRIVATE
352            tfm_fih
353            tfm_fih_headers
354            tfm_boot_status
355            platform_region_defs
356            bl1_1_shared_lib_interface
357    )
358
359    target_compile_options(platform_bl1_2
360        PUBLIC
361            $<$<BOOL:${BL1_2_SANITIZE}>:-fsanitize=${BL1_2_SANITIZE}>
362            ${BL1_COMPILER_CP_FLAG}
363    )
364
365    target_link_options(platform_bl1_2
366        PUBLIC
367            ${BL1_LINKER_CP_OPTION}
368    )
369endif()
370
371#========================= Platform region defs ===============================#
372
373if(NOT ${MCUBOOT_SIGNATURE_TYPE} STREQUAL "")
374    string(REGEX MATCH "[0-9]*$" SIG_LEN ${MCUBOOT_SIGNATURE_TYPE})
375    string(REGEX MATCH "^[A-Z]*" SIG_TYPE ${MCUBOOT_SIGNATURE_TYPE})
376endif()
377
378#TODO maybe just link the other platforms to this
379target_compile_definitions(platform_region_defs
380    INTERFACE
381        $<$<BOOL:${BL1}>:BL1>
382        $<$<BOOL:${BL2}>:BL2>
383        BL2_HEADER_SIZE=${BL2_HEADER_SIZE}
384        BL2_TRAILER_SIZE=${BL2_TRAILER_SIZE}
385        BL1_HEADER_SIZE=${BL1_HEADER_SIZE}
386        BL1_TRAILER_SIZE=${BL1_TRAILER_SIZE}
387        $<$<BOOL:${PLATFORM_DEFAULT_BL1}>:PLATFORM_DEFAULT_BL1>
388        $<$<BOOL:${SECURE_UART1}>:SECURE_UART1>
389        DAUTH_${DEBUG_AUTHENTICATION}
390        $<$<BOOL:${MCUBOOT_IMAGE_NUMBER}>:MCUBOOT_IMAGE_NUMBER=${MCUBOOT_IMAGE_NUMBER}>
391        $<$<BOOL:${MCUBOOT_BUILTIN_KEY}>:MCUBOOT_BUILTIN_KEY>
392        $<$<STREQUAL:${SIG_TYPE},RSA>:MCUBOOT_SIGN_RSA>
393        $<$<STREQUAL:${SIG_TYPE},RSA>:MCUBOOT_SIGN_RSA_LEN=${SIG_LEN}>
394        $<$<STREQUAL:${SIG_TYPE},EC>:MCUBOOT_SIGN_EC${SIG_LEN}>
395        $<$<STREQUAL:${MCUBOOT_EXECUTION_SLOT},2>:LINK_TO_SECONDARY_PARTITION>
396        $<$<BOOL:${TEST_PSA_API}>:PSA_API_TEST_${TEST_PSA_API}>
397        $<$<BOOL:${TFM_CODE_SHARING}>:CODE_SHARING>
398        $<$<OR:$<CONFIG:Debug>,$<CONFIG:relwithdebinfo>>:ENABLE_HEAP>
399        PLATFORM_NS_NV_COUNTERS=${TFM_NS_NV_COUNTER_AMOUNT}
400        $<$<BOOL:${TFM_HALT_ON_FATAL_ERRORS}>:HALT_ON_FATAL_ERROR>
401        $<$<BOOL:${TFM_LOG_ERR_FILE_AND_LINE}>:FATAL_ERR_LOG_FILE_AND_LINE>
402)
403
404target_include_directories(platform_region_defs
405    INTERFACE
406        ${CMAKE_CURRENT_LIST_DIR}/ext/common
407)
408
409target_link_libraries(platform_region_defs
410    INTERFACE
411        tfm_config
412)
413