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#-------------------------------------------------------------------------------
9
10cmake_policy(SET CMP0076 NEW)
11set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
12
13#========================= Platform region defs ===============================#
14
15target_include_directories(platform_region_defs
16    INTERFACE
17        partition
18        cc312
19)
20
21target_compile_definitions(platform_region_defs
22    INTERFACE
23        $<$<BOOL:${RSE_XIP}>:RSE_XIP>
24        $<$<BOOL:${RSE_DEBUG_UART}>:RSE_DEBUG_UART>
25        $<$<BOOL:${RSE_USE_HOST_UART}>:RSE_USE_HOST_UART>
26        $<$<BOOL:${RSE_USE_HOST_FLASH}>:RSE_USE_HOST_FLASH>
27        $<$<BOOL:${RSE_GPT_SUPPORT}>:RSE_GPT_SUPPORT>
28        $<$<BOOL:${RSE_HAS_EXPANSION_PERIPHERALS}>:RSE_HAS_EXPANSION_PERIPHERALS>
29        $<$<BOOL:${PLATFORM_HAS_PS_NV_OTP_COUNTERS}>:PLATFORM_HAS_PS_NV_OTP_COUNTERS>
30        $<$<BOOL:${RSE_ENABLE_BRINGUP_HELPERS}>:RSE_ENABLE_BRINGUP_HELPERS>
31        $<$<BOOL:${RSE_OTP_TRNG}>:RSE_OTP_TRNG>
32        $<$<BOOL:${RSE_LOAD_NS_IMAGE}>:RSE_LOAD_NS_IMAGE>
33        $<$<BOOL:${RSE_ENABLE_TRAM}>:RSE_ENABLE_TRAM>
34        $<$<BOOL:${RSE_BIT_PROGRAMMABLE_OTP}>:RSE_BIT_PROGRAMMABLE_OTP>
35        $<$<BOOL:${RSE_USE_ROM_LIB_FROM_SRAM}>:RSE_USE_ROM_LIB_FROM_SRAM>
36        $<$<BOOL:${RSE_SUPPORT_ROM_LIB_RELOCATION}>:RSE_SUPPORT_ROM_LIB_RELOCATION>
37        $<$<BOOL:${RSE_BRINGUP_OTP_EMULATION}>:RSE_BRINGUP_OTP_EMULATION>
38        RSE_AMOUNT=${RSE_AMOUNT}
39        $<$<BOOL:${RSE_HAS_MANUFACTURING_DATA}>:RSE_HAS_MANUFACTURING_DATA>
40        $<$<BOOL:${TFM_PARTITION_DELEGATED_ATTESTATION}>:RSE_BOOT_KEYS_CCA>
41        $<$<BOOL:${TFM_PARTITION_DPE}>:RSE_BOOT_KEYS_DPE>
42        LCM_VERSION=0
43        RSE_TP_MODE=LCM_TP_MODE_${RSE_TP_MODE}
44        LCM_DCU_PARITY
45)
46
47#========================= Platform common defs ===============================#
48
49# Specify the location of platform specific build dependencies.
50target_sources(tfm_s
51    PRIVATE
52        ${CMAKE_CURRENT_SOURCE_DIR}/device/source/startup_rse.c
53)
54target_add_scatter_file(tfm_s
55        $<$<C_COMPILER_ID:ARMClang>:${PLATFORM_DIR}/ext/common/armclang/tfm_common_s.sct>
56        $<$<C_COMPILER_ID:GNU>:${PLATFORM_DIR}/ext/common/gcc/tfm_common_s.ld>
57)
58
59target_sources(bl2
60    PRIVATE
61        ${CMAKE_CURRENT_SOURCE_DIR}/device/source/startup_rse_bl.c
62        $<$<BOOL:${PLATFORM_HAS_BOOT_DMA}>:${CMAKE_CURRENT_SOURCE_DIR}/bl2/boot_dma.c>
63)
64
65target_add_scatter_file(bl2
66        $<$<C_COMPILER_ID:ARMClang>:${PLATFORM_DIR}/ext/common/armclang/tfm_common_bl2.sct>
67        $<$<C_COMPILER_ID:GNU>:${PLATFORM_DIR}/ext/common/gcc/tfm_common_bl2.ld>
68)
69
70target_compile_options(bl2_scatter
71    PRIVATE
72        $<$<BOOL:${PLATFORM_HAS_BOOT_DMA}>:${COMPILER_CMSE_FLAG}>
73)
74
75target_compile_definitions(bootutil
76    PRIVATE
77        MULTIPLE_EXECUTABLE_RAM_REGIONS
78)
79
80target_sources(bl1_1
81    PRIVATE
82        ${CMAKE_CURRENT_SOURCE_DIR}/device/source/startup_rse_bl1_1.c
83)
84target_add_scatter_file(bl1_1
85        $<$<C_COMPILER_ID:ARMClang>:${CMAKE_CURRENT_SOURCE_DIR}/device/source/armclang/rse_bl1_1.sct>
86        $<$<C_COMPILER_ID:GNU>:${CMAKE_CURRENT_SOURCE_DIR}/device/source/gcc/rse_bl1_1.ld>
87)
88
89target_sources(bl1_2
90    PRIVATE
91        ${CMAKE_CURRENT_SOURCE_DIR}/device/source/startup_rse_bl.c
92)
93target_add_scatter_file(bl1_2
94        $<$<C_COMPILER_ID:ARMClang>:${CMAKE_CURRENT_SOURCE_DIR}/device/source/armclang/rse_bl1_2.sct>
95        $<$<C_COMPILER_ID:GNU>:${CMAKE_CURRENT_SOURCE_DIR}/device/source/gcc/rse_bl1_2.ld>
96)
97
98
99install(FILES       tfm_builtin_key_ids.h
100        DESTINATION ${INSTALL_INTERFACE_INC_DIR})
101
102#========================= Platform Secure ====================================#
103
104if (TFM_MULTI_CORE_TOPOLOGY)
105    add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/rse_comms rse_comms)
106endif()
107
108if (RSE_AMOUNT GREATER 1)
109    add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/rse_handshake rse_handshake)
110endif()
111
112add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/provisioning provisioning)
113
114# Set which PLATFORM depedency must be used by the CC3XX driver
115set(CC3XX_PLATFORM_INTERFACE platform_bl1_1_interface)
116add_subdirectory(${PLATFORM_DIR}/ext/accelerator/cc312/cc312-rom cc312-rom)
117
118target_include_directories(platform_s
119    PUBLIC
120        .
121        ../common
122        cmsis_drivers
123        cmsis_drivers/config
124        device
125        device/config
126        device/include
127        device/source/armclang
128        dpe
129        native_drivers
130        libraries
131        partition
132        services/src
133        ${PLATFORM_DIR}/..
134        ${PLATFORM_DIR}/ext/target/arm/drivers/counter/armv8m
135        ${PLATFORM_DIR}/ext/target/arm/drivers/mpc_sie
136        ${PLATFORM_DIR}/ext/target/arm/drivers/mpu/armv8m
137        ${PLATFORM_DIR}/ext/target/arm/drivers/sam
138        ${PLATFORM_DIR}/ext/target/arm/drivers/timer/armv8m
139        ${PLATFORM_DIR}/ext/target/arm/drivers/usart/cmsdk
140        ${PLATFORM_DIR}/ext/target/arm/drivers/usart/common
141        ${PLATFORM_DIR}/ext/target/arm/drivers/dma/dma350
142        ${PLATFORM_DIR}/ext/target/arm/drivers/kmu
143        ${PLATFORM_DIR}/ext/target/arm/drivers/lcm
144        ${PLATFORM_DIR}/ext/target/arm/drivers/gpio/pl061
145        ./bringup_helpers
146)
147
148target_sources(platform_s
149    PRIVATE
150        cmsis_drivers/Driver_MPC.c
151        cmsis_drivers/Driver_PPC.c
152        device/source/device_definition.c
153        device/source/system_core_init.c
154        $<$<BOOL:${TFM_PARTITION_DPE}>:${CMAKE_CURRENT_SOURCE_DIR}/dpe/dpe_plat.c>
155        ${PLATFORM_DIR}/ext/target/arm/drivers/dma/dma350/dma350_lib.c
156        $<$<BOOL:${RSE_USE_SDS_LIB}>:${CMAKE_CURRENT_SOURCE_DIR}/libraries/sds.c>
157        $<$<BOOL:${RSE_USE_SDS_LIB}>:${CMAKE_CURRENT_SOURCE_DIR}/libraries/sds_svc.c>
158        native_drivers/atu_rse_drv.c
159        ${PLATFORM_DIR}/ext/target/arm/drivers/dma/dma350/dma350_drv.c
160        ${PLATFORM_DIR}/ext/target/arm/drivers/dma/dma350/dma350_ch_drv.c
161        ${PLATFORM_DIR}/ext/target/arm/drivers/kmu/kmu_drv.c
162        native_drivers/sic_drv.c
163        $<$<EQUAL:${PLAT_MHU_VERSION},2>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/mhu_v2_x.c>
164        $<$<EQUAL:${PLAT_MHU_VERSION},2>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/mhu_wrapper_v2_x.c>
165        $<$<EQUAL:${PLAT_MHU_VERSION},3>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/mhu_v3_x.c>
166        $<$<EQUAL:${PLAT_MHU_VERSION},3>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/mhu_wrapper_v3_x.c>
167        native_drivers/ppc_rse_drv.c
168        native_drivers/integrity_checker_drv.c
169        ${PLATFORM_DIR}/ext/target/arm/drivers/counter/armv8m/syscounter_armv8-m_cntrl_drv.c
170        ${PLATFORM_DIR}/ext/target/arm/drivers/mpc_sie/mpc_sie_drv.c
171        ${PLATFORM_DIR}/ext/target/arm/drivers/mpu/armv8m/mpu_armv8m_drv.c
172        ${PLATFORM_DIR}/ext/target/arm/drivers/sam/sam_drv.c
173        ${PLATFORM_DIR}/ext/target/arm/drivers/timer/armv8m/systimer_armv8-m_drv.c
174        $<$<BOOL:${RSE_DEBUG_UART}>:${CMAKE_CURRENT_SOURCE_DIR}/cmsis_drivers/Driver_USART_cmsdk.c>
175        $<$<BOOL:${RSE_DEBUG_UART}>:${PLATFORM_DIR}/ext/target/arm/drivers/usart/cmsdk/uart_cmsdk_drv.c>
176        tfm_peripherals_def.c
177        $<$<OR:$<BOOL:${TFM_PARTITION_SLIH_TEST}>,$<BOOL:${TFM_PARTITION_FLIH_TEST}>>:${CMAKE_CURRENT_SOURCE_DIR}/plat_test.c>
178        $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/services/src/tfm_platform_system.c>
179        ${PLATFORM_DIR}/ext/target/arm/drivers/lcm/lcm_drv.c
180        otp_lcm.c
181        nv_counters.c
182        attest_hal.c
183        sam_interrupts.c
184        tfm_hal_platform_reset.c
185        $<$<BOOL:${PLATFORM_SVC_HANDLERS}>:${CMAKE_CURRENT_SOURCE_DIR}/platform_svc_handler.c>
186        $<$<BOOL:${PLATFORM_SVC_HANDLERS}>:${PLATFORM_DIR}/ext/target/arm/drivers/dma/dma350/dma350_checker_layer.c>
187        $<$<BOOL:${PLATFORM_SVC_HANDLERS}>:${CMAKE_CURRENT_SOURCE_DIR}/device/source/dma350_checker_device_defs.c>
188        spm_dma_copy.c
189        ${PLATFORM_DIR}/ext/target/arm/drivers/gpio/pl061/gpio_pl061_drv.c
190        ./platform_fatal_error.c
191)
192
193target_link_libraries(platform_s
194    PRIVATE
195        tfm_sprt # For tfm_strnlen in attest HAL
196)
197
198target_sources(tfm_sprt
199    PRIVATE
200        # SLIH test Partition and FLIH test Partition access the timer as ARoT Partitions.
201        # Put the driver to SPRT so that both SLIH and FLIH tests can access it.
202        $<$<OR:$<BOOL:${TFM_PARTITION_SLIH_TEST}>,$<BOOL:${TFM_PARTITION_FLIH_TEST}>>:${PLATFORM_DIR}/ext/target/arm/drivers/timer/armv8m/systimer_armv8-m_drv.c>
203)
204
205target_compile_definitions(platform_s
206    INTERFACE
207        ATTEST_KEY_BITS=${ATTEST_KEY_BITS}
208        spm_memcpy=spm_dma_memcpy
209    PRIVATE
210        # Needed for DMA-350 library
211        CMSIS_device_header="rse.h"
212        $<$<BOOL:${PLATFORM_SVC_HANDLERS}>:PLATFORM_SVC_HANDLERS>
213        $<$<BOOL:${RSE_USE_SDS_LIB}>:RSE_USE_SDS_LIB>
214)
215
216target_compile_options(platform_s
217    PUBLIC
218        ${COMPILER_CMSE_FLAG}
219)
220
221#========================= Platform Crypto Keys ===============================#
222
223if (TFM_PARTITION_CRYPTO)
224    target_sources(platform_crypto_keys
225        PRIVATE
226            crypto_keys.c
227    )
228
229    target_include_directories(platform_crypto_keys
230        PUBLIC
231            .
232            ./native_drivers
233            ./device/include
234            ./device/config
235    )
236endif()
237
238#========================= Platform BL2 =======================================#
239
240target_sources(platform_bl2
241    PRIVATE
242        tfm_hal_platform_reset.c
243        device/source/device_definition.c
244        device/source/system_core_init.c
245        $<$<BOOL:${PLATFORM_HAS_NI_TOWER}>:${CMAKE_CURRENT_SOURCE_DIR}/host_drivers/ni_tower/apu/ni_tower_apu_drv.c>
246        $<$<BOOL:${PLATFORM_HAS_NI_TOWER}>:${CMAKE_CURRENT_SOURCE_DIR}/host_drivers/ni_tower/discovery/ni_tower_discovery_drv.c>
247        $<$<BOOL:${PLATFORM_HAS_NI_TOWER}>:${CMAKE_CURRENT_SOURCE_DIR}/host_drivers/ni_tower/psam/ni_tower_psam_drv.c>
248        $<$<BOOL:${PLATFORM_HAS_NI_TOWER}>:${CMAKE_CURRENT_SOURCE_DIR}/host_drivers/ni_tower/util/ni_tower_util.c>
249        $<$<BOOL:${PLATFORM_HAS_NI_TOWER}>:${CMAKE_CURRENT_SOURCE_DIR}/host_drivers/ni_tower/ni_tower_rse_drv.c>
250        $<$<BOOL:${PLATFORM_HAS_SMMU_V3}>:${CMAKE_CURRENT_SOURCE_DIR}/host_drivers/smmu_v3/smmu_v3_drv.c>
251        $<$<BOOL:${PLATFORM_HAS_BOOT_DMA}>:${PLATFORM_DIR}/ext/target/arm/drivers/dma/dma350/dma350_lib.c>
252        native_drivers/atu_rse_drv.c
253        $<$<BOOL:${PLATFORM_HAS_BOOT_DMA}>:${PLATFORM_DIR}/ext/target/arm/drivers/dma/dma350/dma350_ch_drv.c>
254        $<$<BOOL:${PLATFORM_HAS_BOOT_DMA}>:${PLATFORM_DIR}/ext/target/arm/drivers/dma/dma350/dma350_drv.c>
255        ${PLATFORM_DIR}/ext/target/arm/drivers/kmu/kmu_drv.c
256        native_drivers/sic_drv.c
257        $<$<EQUAL:${PLAT_MHU_VERSION},2>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/mhu_v2_x.c>
258        $<$<EQUAL:${PLAT_MHU_VERSION},2>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/mhu_wrapper_v2_x.c>
259        $<$<EQUAL:${PLAT_MHU_VERSION},3>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/mhu_v3_x.c>
260        $<$<EQUAL:${PLAT_MHU_VERSION},3>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/mhu_wrapper_v3_x.c>
261        $<$<BOOL:${RSE_DEBUG_UART}>:${CMAKE_CURRENT_SOURCE_DIR}/cmsis_drivers/Driver_USART_cmsdk.c>
262        $<$<BOOL:${RSE_DEBUG_UART}>:${PLATFORM_DIR}/ext/target/arm/drivers/usart/cmsdk/uart_cmsdk_drv.c>
263        ${PLATFORM_DIR}/ext/target/arm/drivers/lcm/lcm_drv.c
264        native_drivers/integrity_checker_drv.c
265        otp_lcm.c
266        nv_counters.c
267        $<$<BOOL:${RSE_XIP}>:${CMAKE_CURRENT_SOURCE_DIR}/bl2/sic_boot.c>
268        ${PLATFORM_DIR}/ext/target/arm/drivers/gpio/pl061/gpio_pl061_drv.c
269        ./platform_fatal_error.c
270)
271
272target_include_directories(platform_bl2
273    PUBLIC
274        .
275        bl2
276        cmsis_drivers
277        cmsis_drivers/config
278        device
279        device/config
280        device/include
281        device/source/armclang
282        $<$<BOOL:${PLATFORM_HAS_NI_TOWER}>:${CMAKE_CURRENT_SOURCE_DIR}/host_drivers/ni_tower>
283        $<$<BOOL:${PLATFORM_HAS_SMMU_V3}>:${CMAKE_CURRENT_SOURCE_DIR}/host_drivers/smmu_v3>
284        native_drivers
285        partition
286        services/src
287        libraries
288        ${PLATFORM_DIR}/ext/target/arm/drivers/counter/armv8m
289        ${PLATFORM_DIR}/ext/target/arm/drivers/mpc_sie
290        ${PLATFORM_DIR}/ext/target/arm/drivers/sam
291        ${PLATFORM_DIR}/ext/target/arm/drivers/timer/armv8m
292        ${PLATFORM_DIR}/ext/target/arm/drivers/usart/cmsdk
293        ${PLATFORM_DIR}/ext/target/arm/drivers/usart/common
294        ${PLATFORM_DIR}/ext/target/arm/drivers/dma/dma350
295        ${PLATFORM_DIR}/ext/target/arm/drivers/kmu
296        ${PLATFORM_DIR}/ext/target/arm/drivers/lcm
297        ${PLATFORM_DIR}/ext/target/arm/drivers/gpio/pl061
298        ./bringup_helpers
299    PRIVATE
300        ${PLATFORM_DIR}/..
301)
302
303target_compile_definitions(platform_bl2
304    PRIVATE
305        $<$<BOOL:${TFM_PARTITION_DELEGATED_ATTESTATION}>:RSE_BOOT_KEYS_CCA>
306        $<$<BOOL:${TFM_PARTITION_DPE}>:RSE_BOOT_KEYS_DPE>
307        # Needed for DMA-350 library
308        $<$<BOOL:${PLATFORM_HAS_BOOT_DMA}>:PLATFORM_HAS_BOOT_DMA>
309        $<$<BOOL:${PLATFORM_BOOT_DMA_MIN_SIZE_REQ}>:BOOT_DMA_MIN_SIZE_REQ=${PLATFORM_BOOT_DMA_MIN_SIZE_REQ}>
310        $<$<BOOL:${PLATFORM_HAS_BOOT_DMA}>:CMSIS_device_header="rse.h">
311        $<$<BOOL:${PLATFORM_HAS_NI_TOWER}>:PLATFORM_HAS_NI_TOWER>
312        $<$<BOOL:${PLATFORM_HAS_SMMU_V3}>:PLATFORM_HAS_SMMU_V3>
313)
314
315target_compile_options(platform_bl2
316    PUBLIC
317        $<$<BOOL:${PLATFORM_HAS_BOOT_DMA}>:${COMPILER_CMSE_FLAG}>
318)
319
320#========================= Platform bl1_1 =======================================#
321
322target_sources(platform_bl1_1
323    PRIVATE
324        ./bl1/boot_hal_bl1_1.c
325        ./device/source/device_definition.c
326        ./device/source/system_core_init.c
327        ./native_drivers/atu_rse_drv.c
328        ${PLATFORM_DIR}/ext/target/arm/drivers/kmu/kmu_drv.c
329        ${PLATFORM_DIR}/ext/target/arm/drivers/lcm/lcm_drv.c
330        $<$<EQUAL:${PLAT_MHU_VERSION},2>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/mhu_v2_x.c>
331        $<$<EQUAL:${PLAT_MHU_VERSION},2>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/mhu_wrapper_v2_x.c>
332        $<$<EQUAL:${PLAT_MHU_VERSION},3>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/mhu_v3_x.c>
333        $<$<EQUAL:${PLAT_MHU_VERSION},3>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/mhu_wrapper_v3_x.c>
334        ./native_drivers/tram_drv.c
335        ./native_drivers/integrity_checker_drv.c
336        ./nv_counters.c
337        ./otp_lcm.c
338        ./tfm_hal_platform_reset.c
339        $<$<BOOL:${RSE_DEBUG_UART}>:${CMAKE_CURRENT_SOURCE_DIR}/cmsis_drivers/Driver_USART_cmsdk.c>
340        $<$<BOOL:${RSE_DEBUG_UART}>:${PLATFORM_DIR}/ext/target/arm/drivers/usart/cmsdk/uart_cmsdk_drv.c>
341        ./dpa_hardened_word_copy.c
342        ./cc312/cc3xx_aes_external_key_loader.c
343        $<$<BOOL:${RSE_ENABLE_BRINGUP_HELPERS}>:${CMAKE_CURRENT_SOURCE_DIR}/bringup_helpers/rse_bringup_helpers.c>
344        $<$<BOOL:${RSE_BRINGUP_OTP_EMULATION}>:${CMAKE_CURRENT_SOURCE_DIR}/bringup_helpers/rse_bl1_2_image_otp_or_flash.c>
345        ./rse_key_derivation.c
346        $<$<BOOL:${RSE_SUPPORT_ROM_LIB_RELOCATION}>:${CMAKE_CURRENT_SOURCE_DIR}/bl1/bl1_patch_stubs.c>
347        ${PLATFORM_DIR}/ext/target/arm/drivers/gpio/pl061/gpio_pl061_drv.c
348        ./platform_fatal_error.c
349)
350
351target_include_directories(platform_bl1_1_interface
352    INTERFACE
353        .
354        ./cmsis_drivers
355        ./cmsis_drivers/config
356        ./device/config
357        ./device/include
358        ./native_drivers
359        ${PLATFORM_DIR}/ext/target/arm/drivers/counter/armv8m
360        ${PLATFORM_DIR}/ext/target/arm/drivers/mpc_sie
361        ${PLATFORM_DIR}/ext/target/arm/drivers/sam
362        ${PLATFORM_DIR}/ext/target/arm/drivers/timer/armv8m
363        ${PLATFORM_DIR}/ext/target/arm/drivers/usart/cmsdk
364        ${PLATFORM_DIR}/ext/target/arm/drivers/usart/common
365        ${PLATFORM_DIR}/ext/target/arm/drivers/dma/dma350
366        ${PLATFORM_DIR}/ext/target/arm/drivers/kmu
367        ${PLATFORM_DIR}/ext/target/arm/drivers/lcm
368        ${PLATFORM_DIR}/ext/accelerator/cc312/cc312-rom
369        ${PLATFORM_DIR}/ext/target/arm/drivers/gpio/pl061
370        ./bringup_helpers
371)
372
373target_compile_definitions(platform_bl1_1_interface
374    INTERFACE
375        $<$<BOOL:${TFM_PARTITION_DELEGATED_ATTESTATION}>:RSE_BOOT_KEYS_CCA>
376        $<$<BOOL:${TFM_PARTITION_DPE}>:RSE_BOOT_KEYS_DPE>
377        KMU_CONFIG_EXTERNAL_SECURE_WORD_COPY
378        $<$<BOOL:${RSE_ENCRYPTED_OTP_KEYS}>:RSE_ENCRYPTED_OTP_KEYS>
379)
380
381target_link_libraries(platform_bl1_1
382    PRIVATE
383        cc312_rom
384        bl1_1_shared_lib_interface
385)
386
387if(RSE_SUPPORT_ROM_LIB_RELOCATION)
388    target_compile_options(platform_bl1_1
389        PUBLIC
390            # Enable position independent code
391            -fpic
392            # Tell the compiler that it can't assume the offset between the data
393            # and code sections doesn't change
394            -mno-pic-data-is-text-relative
395            # Set r9 as the register to use for the GOT. This register will not
396            # be used for any other purpose. If this is changed, some of the ASM
397            # setup functions will need to be changed.
398            -mpic-register=r9
399            # Tell the compiler it can assume that r9 will always contain the
400            # address of the GOT, and that it doesn't need to try to set r9
401            # itself (we do it in the initial setup).
402            -msingle-pic-base
403            # Insert stub function calls into every function which can then be
404            # replaced with calls to patched versions of the function.
405            -finstrument-functions
406            # Don't insert stub function into the stub functions, or the early
407            # startup files where we are still setting up the GOT
408            -finstrument-functions-exclude-file-list=bl1_patch_stubs,startup_rse_bl1_1
409            # Don't insert stub function into functions where the stack isn't
410            # valid.
411            -finstrument-functions-exclude-function-list=boot_platform_quit,boot_jump_to_next_image
412    )
413endif()
414
415if (RSE_USE_ROM_LIB_FROM_SRAM)
416    add_custom_target(bl1_1_shared_symbols_in_sram
417        DEPENDS bl1_1
418        SOURCES ${CMAKE_BINARY_DIR}/bin/bl1_1${CODE_SHARING_INPUT_FILE_SUFFIX}
419    )
420
421    add_custom_command(
422        OUTPUT ${CMAKE_BINARY_DIR}/bin/bl1_1${CODE_SHARING_INPUT_FILE_SUFFIX}
423        DEPENDS ${CMAKE_BINARY_DIR}/bin/bl1_1${CODE_SHARING_OUTPUT_FILE_SUFFIX}
424        COMMAND ${CMAKE_OBJCOPY} ${CMAKE_BINARY_DIR}/bin/bl1_1${CODE_SHARING_OUTPUT_FILE_SUFFIX}
425                --change-section-address .text\*+0x20010000
426                ${CMAKE_BINARY_DIR}/bin/bl1_1${CODE_SHARING_INPUT_FILE_SUFFIX}
427    )
428
429    add_dependencies(bl1_2
430        bl1_1_shared_symbols_in_sram
431    )
432endif()
433
434target_sources(bl1_1_shared_lib
435    PRIVATE
436        $<$<NOT:$<BOOL:${TFM_BL1_SOFTWARE_CRYPTO}>>:${CMAKE_CURRENT_SOURCE_DIR}/bl1/cc312_rom_crypto.c>
437        $<$<AND:$<NOT:$<BOOL:${RSE_OTP_TRNG}>>,$<NOT:$<BOOL:${TFM_BL1_DUMMY_TRNG}>>>:${CMAKE_CURRENT_SOURCE_DIR}/bl1/cc312_rom_trng.c>
438        $<$<AND:$<BOOL:${RSE_OTP_TRNG}>,$<NOT:$<BOOL:${TFM_BL1_DUMMY_TRNG}>>>:${CMAKE_CURRENT_SOURCE_DIR}/rse_trng.c>
439)
440
441target_link_libraries(cc312_rom
442    PRIVATE
443        platform_bl1_1
444)
445
446#========================= Platform BL1_2 =====================================#
447
448target_sources(platform_bl1_2
449    PRIVATE
450        device/source/system_core_init.c
451        ./bl1/boot_hal_bl1_2.c
452        ${PLATFORM_DIR}/ext/target/arm/drivers/mpu/armv8m/mpu_armv8m_drv.c
453        $<$<BOOL:${PLATFORM_PSA_ADAC_SECURE_DEBUG}>:${PLATFORM_DIR}/ext/target/arm/drivers/lcm/lcm_drv.c>
454        $<$<BOOL:${PLATFORM_PSA_ADAC_SECURE_DEBUG}>:${CMAKE_CURRENT_SOURCE_DIR}/device/source/device_definition.c>
455        $<$<BOOL:${PLATFORM_PSA_ADAC_SECURE_DEBUG}>:${CMAKE_CURRENT_SOURCE_DIR}/platform_dcu.c>
456)
457
458target_include_directories(platform_bl1_2
459    PRIVATE
460        .
461        ${PLATFORM_DIR}/ext/target/arm/drivers/mpu/armv8m
462        ${PLATFORM_DIR}/ext/target/arm/drivers/dma/dma350
463        ${PLATFORM_DIR}/ext/target/arm/drivers/kmu
464        ${PLATFORM_DIR}/ext/target/arm/drivers/lcm
465)
466
467target_compile_definitions(platform_bl1_2
468    PUBLIC
469        $<$<BOOL:${TFM_PARTITION_DELEGATED_ATTESTATION}>:RSE_BOOT_KEYS_CCA>
470        $<$<BOOL:${TFM_PARTITION_DPE}>:RSE_BOOT_KEYS_DPE>
471        $<$<BOOL:${PLATFORM_PSA_ADAC_SECURE_DEBUG}>:PLATFORM_PSA_ADAC_SECURE_DEBUG>
472)
473
474if(RSE_USE_HOST_FLASH)
475    add_subdirectory(./fip_parser)
476endif()
477
478if(RSE_SUPPORT_ROM_LIB_RELOCATION)
479    target_compile_options(platform_bl1_2
480        PUBLIC
481            # Prevent BL1_2 from using r9
482            -ffixed-reg=r9
483            # Inlining causes gcc to generate reads and writes to r9. This is
484            # probably a bug, but work around it by not inlining functions.
485            -fno-inline
486    )
487endif()
488
489#========================= ns_agent_mailbox ===================================#
490
491if(TFM_MULTI_CORE_TOPOLOGY)
492    target_sources(tfm_psa_rot_partition_ns_agent_mailbox
493        PRIVATE
494            ${CMAKE_CURRENT_SOURCE_DIR}/tfm_hal_multi_core.c
495    )
496endif()
497
498#========================= tfm_spm ============================================#
499
500target_sources(tfm_spm
501    PRIVATE
502        target_cfg.c
503        ${PLATFORM_DIR}/ext/common/tfm_hal_isolation_v8m.c
504        tfm_hal_platform.c
505        tfm_interrupts.c
506        faults.c
507)
508
509#=========================== CPAK generator tool ===============================
510
511find_package(Python3)
512
513add_custom_target(cpak_generator
514    SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpak_generator/cpak_generator.c
515)
516
517add_dependencies(cpak_generator
518    bl1_2_padded_bin
519)
520
521add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpak_generator/cpak_generator
522    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cpak_generator/cpak_generator.c
523    COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/cpak_generator
524    COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_SOURCE_DIR}/cpak_generator
525                             -B ${CMAKE_CURRENT_BINARY_DIR}/cpak_generator
526                             -G ${CMAKE_GENERATOR}
527                             -DMBEDCRYPTO_PATH=${MBEDCRYPTO_PATH}
528                             -DBL1_2_HASH_PATH=\\\"$<TARGET_FILE_DIR:bl1_2>/bl1_2_padded_hash.bin\\\"
529                             -DGUK_PATH=\\\"${TFM_GUK_PATH}\\\"
530                             -DCPAK_OUTPUT_PATH=\\\"${CMAKE_CURRENT_BINARY_DIR}/cpak_generator/cpak_public.bin\\\"
531                             -DRSE_TP_MODE=${RSE_TP_MODE}
532    COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/cpak_generator
533)
534
535add_custom_target(cpak_public ALL
536    DEPENDS ${TFM_GUK_PATH}
537    DEPENDS cpak_generator
538    DEPENDS ${CMAKE_BINARY_DIR}/bin/bl1_2_padded_hash.bin
539    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/cpak_generator/cpak_generator
540    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cpak_generator/bin_to_pem.py
541    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cpak_generator/
542    COMMAND ${CMAKE_CURRENT_BINARY_DIR}/cpak_generator/cpak_generator
543    COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/cpak_generator/bin_to_pem.py
544                    --input_key_file ${CMAKE_CURRENT_BINARY_DIR}/cpak_generator/cpak_public.bin
545                    --output_key_file ${CMAKE_CURRENT_BINARY_DIR}/cpak_generator/cpak_public.pem
546    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/cpak_generator/cpak_public.bin $<TARGET_FILE_DIR:bl1_1>
547    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/cpak_generator/cpak_public.pem $<TARGET_FILE_DIR:bl1_1>
548)
549
550############################### IMAGE SIGNING ##################################
551
552if (RSE_XIP)
553    find_package(Python3)
554
555    add_custom_target(public_key ALL
556        SOURCES
557            image_s_signing_public_key.pem
558            image_ns_signing_public_key.pem
559    )
560    add_custom_command(OUTPUT image_s_signing_public_key.pem
561        # If MCUBOOT_GENERATE_SIGNING_KEYPAIR=ON then the command should depend on that
562        # to make sure that the key is generated and copied to the MCUBOOT_KEY_S path.
563        DEPENDS $<IF:$<BOOL:${MCUBOOT_GENERATE_SIGNING_KEYPAIR}>,generated_private_key,>
564        COMMAND ${Python3_EXECUTABLE} ${MCUBOOT_PATH}/scripts/imgtool.py
565            getpub
566            -k ${MCUBOOT_KEY_S}
567            -e pem
568            -o image_s_signing_public_key.pem
569        COMMAND ${CMAKE_COMMAND} -E copy image_s_signing_public_key.pem $<TARGET_FILE_DIR:bl2>
570    )
571    add_custom_command(OUTPUT image_ns_signing_public_key.pem
572        # If MCUBOOT_GENERATE_SIGNING_KEYPAIR=ON then the command should depend on that
573        # to make sure that the key is generated and copied to the MCUBOOT_KEY_NS path.
574        DEPENDS $<IF:$<BOOL:${MCUBOOT_GENERATE_SIGNING_KEYPAIR}>,generated_private_key,>
575        COMMAND ${Python3_EXECUTABLE} ${MCUBOOT_PATH}/scripts/imgtool.py
576            getpub
577            -k ${MCUBOOT_KEY_NS}
578            -e pem
579            -o image_ns_signing_public_key.pem
580        COMMAND ${CMAKE_COMMAND} -E copy image_ns_signing_public_key.pem $<TARGET_FILE_DIR:bl2>
581    )
582
583    add_custom_target(tfm_s_sic_tables
584        SOURCES bin/tfm_s_sic_tables.bin
585    )
586
587    add_custom_command(OUTPUT bin/tfm_s_sic_tables.bin
588        DEPENDS $<TARGET_FILE_DIR:tfm_s>/tfm_s.bin
589        DEPENDS tfm_s_bin
590        COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/bl2/create_xip_tables.py
591            --input_image $<TARGET_FILE_DIR:tfm_s>/tfm_s.bin
592            --table_output_file tfm_s_sic_tables.bin
593            --encrypted_image_output_file tfm_s_encrypted.bin
594            --image_version ${MCUBOOT_SECURITY_COUNTER_S}
595        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/tfm_s_sic_tables.bin $<TARGET_FILE_DIR:tfm_s>
596        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/tfm_s_encrypted.bin $<TARGET_FILE_DIR:tfm_s>
597    )
598
599    set(IMAGE_TYPE "S_IMAGE")
600    set(FLASH_AREA_NUM ${MCUBOOT_S_IMAGE_FLASH_AREA_NUM})
601    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/bl2/signing_layout_sic_tables.c.in signing_layout_s.c @ONLY)
602    add_library(signing_layout_s OBJECT ${CMAKE_CURRENT_BINARY_DIR}/signing_layout_s.c)
603
604    target_compile_options(signing_layout_s
605        PRIVATE
606            $<$<C_COMPILER_ID:GNU>:-E\;-xc>
607            $<$<C_COMPILER_ID:ARMClang>:-E\;-xc>
608            $<$<C_COMPILER_ID:IAR>:--preprocess=ns\;$<TARGET_OBJECTS:signing_layout_s>>
609    )
610    target_compile_definitions(signing_layout_s
611        PRIVATE
612            $<$<BOOL:${BL2}>:BL2>
613            $<$<BOOL:${MCUBOOT_IMAGE_NUMBER}>:MCUBOOT_IMAGE_NUMBER=${MCUBOOT_IMAGE_NUMBER}>
614            $<$<STREQUAL:${MCUBOOT_UPGRADE_STRATEGY},DIRECT_XIP>:IMAGE_ROM_FIXED>
615    )
616    target_link_libraries(signing_layout_s
617        PRIVATE
618            platform_bl2
619    )
620
621    add_custom_target(tfm_s_sic_tables_signed_bin
622        SOURCES bin/tfm_s_sic_tables_signed.bin
623    )
624    add_custom_command(OUTPUT bin/tfm_s_sic_tables_signed.bin
625        DEPENDS tfm_s_sic_tables
626        DEPENDS tfm_s_bin signing_layout_s
627        WORKING_DIRECTORY ${MCUBOOT_PATH}/scripts
628
629        #Sign secure binary image with provided secret key
630        COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/scripts/wrapper/wrapper.py
631            -v ${MCUBOOT_IMAGE_VERSION_S}
632            --layout $<TARGET_OBJECTS:signing_layout_s>
633            -k ${MCUBOOT_KEY_S}
634            --public-key-format $<IF:$<BOOL:${MCUBOOT_HW_KEY}>,full,hash>
635            --align ${MCUBOOT_ALIGN_VAL}
636            --pad
637            --pad-header
638            -H ${BL2_HEADER_SIZE}
639            -s ${MCUBOOT_SECURITY_COUNTER_S}
640            -L ${MCUBOOT_ENC_KEY_LEN}
641            -d \"\(1,${MCUBOOT_NS_IMAGE_MIN_VER}\)\"
642            $<$<STREQUAL:${MCUBOOT_UPGRADE_STRATEGY},OVERWRITE_ONLY>:--overwrite-only>
643            $<$<BOOL:${MCUBOOT_ENC_IMAGES}>:-E${MCUBOOT_KEY_ENC}>
644            $<$<BOOL:${MCUBOOT_MEASURED_BOOT}>:--measured-boot-record>
645            $<TARGET_FILE_DIR:tfm_s>/tfm_s_sic_tables.bin
646            ${CMAKE_CURRENT_BINARY_DIR}/tfm_s_sic_tables_signed.bin
647        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/tfm_s_sic_tables_signed.bin $<TARGET_FILE_DIR:bl2>
648    )
649
650    add_custom_target(signed_images
651        ALL
652        DEPENDS bin/tfm_s_sic_tables_signed.bin
653    )
654
655    set(IMAGE_TYPE "NS_IMAGE")
656    set(FLASH_AREA_NUM ${MCUBOOT_NS_IMAGE_FLASH_AREA_NUM})
657    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/bl2/signing_layout_sic_tables.c.in
658                   ${CMAKE_CURRENT_BINARY_DIR}/signing_layout_sic_tables_ns.c @ONLY)
659
660    install(FILES       ${CMAKE_CURRENT_BINARY_DIR}/signing_layout_sic_tables_ns.c
661            DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/layout_files)
662
663    install(FILES       bl2/create_xip_tables.py
664            DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/scripts)
665
666    install(DIRECTORY ${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/scripts
667            DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}
668            PATTERN "scripts/*.py"
669            PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
670            GROUP_EXECUTE GROUP_READ
671            PATTERN "scripts/wrapper/*.py"
672            PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
673                        GROUP_EXECUTE GROUP_READ)
674
675    install(DIRECTORY ${MCUBOOT_PATH}/scripts/imgtool
676            DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/scripts)
677
678    install(FILES ${MCUBOOT_KEY_NS}
679            RENAME image_ns_signing_private_key.pem
680            DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/keys/)
681    install(FILES $<TARGET_FILE_DIR:bl2>/image_ns_signing_public_key.pem
682            DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/keys)
683
684    if (MCUBOOT_ENC_IMAGES)
685        install(FILES ${MCUBOOT_KEY_ENC}
686                RENAME image_enc_key.pem
687                DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/keys)
688    endif()
689endif()
690
691############################## BL1 DMA ###################################
692set(bin_dir ${CMAKE_BINARY_DIR}/bin)
693
694add_custom_target(dma_icses
695    ALL
696    SOURCES rom_dma_ics.bin ${bin_dir}/rom_dma_ics.bin
697            rom_dma_ics.hex ${bin_dir}/rom_dma_ics.hex
698            otp_dma_ics.bin ${bin_dir}/otp_dma_ics.bin
699            otp_dma_ics.hex ${bin_dir}/otp_dma_ics.hex
700)
701
702add_custom_command(
703    OUTPUT rom_dma_ics.bin
704    OUTPUT otp_dma_ics.bin
705    OUTPUT rom_dma_ics.hex
706    OUTPUT otp_dma_ics.hex
707    OUTPUT ${bin_dir}/rom_dma_ics.bin
708    OUTPUT ${bin_dir}/otp_dma_ics.bin
709    OUTPUT ${bin_dir}/rom_dma_ics.hex
710    OUTPUT ${bin_dir}/otp_dma_ics.hex
711    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bl1/scripts/create_bl1_1_dma_bin.py
712    COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/bl1/scripts/create_bl1_1_dma_bin.py
713                    --input_file ${CMAKE_CURRENT_SOURCE_DIR}/bl1/scripts/dma_config.yaml
714                    --output_dir ${CMAKE_CURRENT_BINARY_DIR}
715    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/rom_dma_ics.bin $<TARGET_FILE_DIR:bl1_1>
716    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/otp_dma_ics.bin $<TARGET_FILE_DIR:bl1_1>
717    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/rom_dma_ics.hex $<TARGET_FILE_DIR:bl1_1>
718    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/otp_dma_ics.hex $<TARGET_FILE_DIR:bl1_1>
719)
720
721#========================= Files for building NS side platform ================#
722
723install(FILES       ${PLATFORM_DIR}/ext/driver/Driver_Common.h
724                    ${PLATFORM_DIR}/ext/driver/Driver_USART.h
725        DESTINATION ${INSTALL_PLATFORM_NS_DIR}/ext/driver)
726
727install(FILES       device/source/device_definition.c
728                    device/source/startup_rse.c
729                    device/source/system_core_init.c
730        DESTINATION ${INSTALL_PLATFORM_NS_DIR}/device/source
731)
732
733install(FILES       ${PLATFORM_DIR}/ext/common/uart_stdout.c
734                    $<$<BOOL:${RSE_DEBUG_UART}>:${PLATFORM_DIR}/ext/target/arm/drivers/usart/cmsdk/uart_cmsdk_drv.c>
735                    $<$<BOOL:${RSE_DEBUG_UART}>:${CMAKE_CURRENT_SOURCE_DIR}/cmsis_drivers/Driver_USART_cmsdk.c>
736        DESTINATION ${INSTALL_PLATFORM_NS_DIR}
737)
738
739install(DIRECTORY native_drivers
740        DESTINATION ${INSTALL_PLATFORM_NS_DIR}
741)
742
743install(FILES       ${PLATFORM_DIR}/ext/target/arm/drivers/counter/armv8m/syscounter_armv8-m_cntrl_drv.c
744                    ${PLATFORM_DIR}/ext/target/arm/drivers/counter/armv8m/syscounter_armv8-m_cntrl_drv.h
745                    ${PLATFORM_DIR}/ext/target/arm/drivers/mpc_sie/mpc_sie_drv.c
746                    ${PLATFORM_DIR}/ext/target/arm/drivers/mpu/armv8m/mpu_armv8m_drv.c
747                    ${PLATFORM_DIR}/ext/target/arm/drivers/timer/armv8m/systimer_armv8-m_drv.c
748                    ${PLATFORM_DIR}/ext/target/arm/drivers/gpio/pl061/gpio_pl061_drv.c
749                    ${PLATFORM_DIR}/ext/target/arm/drivers/mpc_sie/mpc_sie_drv.h
750                    ${PLATFORM_DIR}/ext/target/arm/drivers/mpu/armv8m/mpu_armv8m_drv.h
751                    ${PLATFORM_DIR}/ext/target/arm/drivers/timer/armv8m/systimer_armv8-m_drv.h
752                    ${PLATFORM_DIR}/ext/target/arm/drivers/gpio/pl061/gpio_pl061_drv.h
753        DESTINATION ${INSTALL_PLATFORM_NS_DIR}/native_drivers
754)
755
756install(FILES       ${PLATFORM_DIR}/ext/accelerator/cc312/crypto_accelerator_config.h
757        DESTINATION ${INSTALL_PLATFORM_NS_DIR}/include
758)
759
760install(FILES       device/config/device_cfg_ns.h
761        DESTINATION ${INSTALL_PLATFORM_NS_DIR}/device/config
762        RENAME      device_cfg.h)
763
764install(DIRECTORY   device/include
765        DESTINATION ${INSTALL_PLATFORM_NS_DIR}/device
766)
767
768install(DIRECTORY   cmsis_drivers
769        DESTINATION ${INSTALL_PLATFORM_NS_DIR}
770)
771
772install(DIRECTORY   partition
773        DESTINATION ${INSTALL_PLATFORM_NS_DIR}
774)
775
776install(FILES       target_cfg.h
777                    tfm_peripherals_def.h
778                    ${PLATFORM_DIR}/include/tfm_plat_defs.h
779                    ${PLATFORM_DIR}/ext/common/uart_stdout.h
780        DESTINATION ${INSTALL_PLATFORM_NS_DIR}/include)
781
782install(DIRECTORY   ns/
783        DESTINATION ${INSTALL_PLATFORM_NS_DIR})
784
785install(FILES       cpuarch.cmake
786        DESTINATION ${INSTALL_PLATFORM_NS_DIR}/config/common)
787
788install(FILES       tests/tfm_tests_config.cmake
789        DESTINATION ${INSTALL_PLATFORM_NS_DIR}/tests/common)
790
791install(FILES       check_config.cmake
792        DESTINATION ${INSTALL_PLATFORM_NS_DIR})
793
794# Install linker scripts
795install(FILES       ${PLATFORM_DIR}/ext/common/gcc/tfm_common_ns.ld
796                    ${PLATFORM_DIR}/ext/common/armclang/tfm_common_ns.sct
797                    ${PLATFORM_DIR}/ext/common/iar/tfm_common_ns.icf
798        DESTINATION ${INSTALL_PLATFORM_NS_DIR}/linker_scripts)
799
800configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ns/config.cmake.in
801               ${INSTALL_PLATFORM_NS_DIR}/config.cmake @ONLY)
802