1#------------------------------------------------------------------------------- 2# Copyright (c) 2020-2024, Arm Limited. All rights reserved. 3# 4# SPDX-License-Identifier: BSD-3-Clause 5# 6#------------------------------------------------------------------------------- 7 8cmake_policy(SET CMP0076 NEW) 9set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}) 10 11#========================= Platform region defs ===============================# 12 13target_include_directories(platform_region_defs 14 INTERFACE 15 partition 16) 17 18#========================= Platform common defs ===============================# 19 20# Specify the location of platform specific build dependencies. 21target_sources(tfm_s 22 PRIVATE 23 ${CMAKE_CURRENT_SOURCE_DIR}/Device/Source/startup_musca.c 24) 25target_add_scatter_file(tfm_s 26 $<$<C_COMPILER_ID:ARMClang>:${PLATFORM_DIR}/ext/common/armclang/tfm_common_s.sct> 27 $<$<C_COMPILER_ID:GNU>:${PLATFORM_DIR}/ext/common/gcc/tfm_common_s.ld> 28 $<$<C_COMPILER_ID:IAR>:${PLATFORM_DIR}/ext/common/iar/tfm_common_s.icf> 29) 30 31if(BL2) 32 target_sources(bl2 33 PRIVATE 34 ${CMAKE_CURRENT_SOURCE_DIR}/Device/Source/startup_musca.c 35 ) 36 target_add_scatter_file(bl2 37 $<$<C_COMPILER_ID:ARMClang>:${PLATFORM_DIR}/ext/common/armclang/tfm_common_bl2.sct> 38 $<$<C_COMPILER_ID:GNU>:${PLATFORM_DIR}/ext/common/gcc/tfm_common_bl2.ld> 39 $<$<C_COMPILER_ID:IAR>:${PLATFORM_DIR}/ext/common/iar/tfm_common_bl2.icf> 40 ) 41endif() 42 43#========================= Platform Secure ====================================# 44 45target_include_directories(platform_s 46 PUBLIC 47 . 48 CMSIS_Driver 49 CMSIS_Driver/Config 50 Device/Config 51 Device/Include 52 Native_Driver 53 partition 54 services/include 55 Libraries 56 driver 57 ${PLATFORM_DIR}/ext/target/arm/drivers/usart/pl011 58 INTERFACE 59 cc312 60) 61 62target_sources(platform_s 63 PRIVATE 64 CMSIS_Driver/Driver_QSPI_Flash.c 65 CMSIS_Driver/Driver_Flash_MRAM.c 66 CMSIS_Driver/Driver_MPC.c 67 CMSIS_Driver/Driver_PPC.c 68 CMSIS_Driver/Driver_USART.c 69 Device/Source/device_definition.c 70 Device/Source/system_core_init.c 71 Native_Driver/mpc_sie200_drv.c 72 Native_Driver/mpu_armv8m_drv.c 73 Native_Driver/ppc_sse200_drv.c 74 Native_Driver/gpio_cmsdk_drv.c 75 Native_Driver/musca_s1_scc_drv.c 76 Native_Driver/qspi_ip6514e_drv.c 77 Native_Driver/cache_drv.c 78 ${PLATFORM_DIR}/ext/target/arm/drivers/usart/pl011/uart_pl011_drv.c 79 ${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver/timer_cmsdk_drv.c 80 Libraries/mt25ql_flash_lib.c 81 ${CMAKE_CURRENT_SOURCE_DIR}/plat_test.c 82 $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/services/src/tfm_platform_system.c> 83) 84 85target_compile_options(platform_s 86 PUBLIC 87 ${COMPILER_CMSE_FLAG} 88) 89 90# To configure S and NS timer in S side for FP interrupt test 91target_compile_definitions(platform_s 92 PUBLIC 93 $<$<BOOL:${TEST_NS_FPU}>:TEST_NS_FPU> 94 $<$<BOOL:${TEST_S_FPU}>:TEST_S_FPU> 95) 96 97#========================= Platform BL2 =======================================# 98 99if(BL2) 100 target_sources(platform_bl2 101 PRIVATE 102 Device/Source/system_core_init.c 103 Device/Source/device_definition.c 104 CMSIS_Driver/Driver_Flash_MRAM.c 105 CMSIS_Driver/Driver_MPC.c 106 Native_Driver/mpc_sie200_drv.c 107 ${PLATFORM_DIR}/ext/target/arm/drivers/usart/pl011/uart_pl011_drv.c 108 Native_Driver/cache_drv.c 109 Native_Driver/musca_s1_scc_drv.c 110 CMSIS_Driver/Driver_USART.c 111 boot_hal_bl2.c 112 ) 113 114 target_include_directories(platform_bl2 115 PUBLIC 116 partition 117 Device/Include 118 Libraries 119 INTERFACE 120 cc312 121 PRIVATE 122 . 123 CMSIS_Driver/Config 124 Device/Config 125 Native_Driver 126 ${PLATFORM_DIR}/ext/target/arm/drivers/usart/pl011 127 ${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/include # for fih.h interop only 128 ${MCUBOOT_PATH}/boot/bootutil/include # for fault_injection_hardening.h only 129 ${CMAKE_BINARY_DIR}/bl2/ext/mcuboot # for mcuboot_config.h only 130 ) 131 132 target_compile_options(platform_bl2 133 PRIVATE 134 ${BL2_COMPILER_CP_FLAG} 135 ) 136endif() 137 138#========================= tfm_spm ============================================# 139 140target_sources(tfm_spm 141 PRIVATE 142 target_cfg.c 143 tfm_hal_isolation.c 144 tfm_hal_platform.c 145 faults.c 146 tfm_interrupts.c 147) 148 149#========================= Files for building NS side platform ================# 150 151install(FILES ${PLATFORM_DIR}/ext/target/arm/drivers/usart/pl011/uart_pl011_drv.c 152 Libraries/mt25ql_flash_lib.c 153 DESTINATION ${INSTALL_PLATFORM_NS_DIR} 154) 155 156install(DIRECTORY Native_Driver 157 CMSIS_Driver 158 services 159 partition 160 DESTINATION ${INSTALL_PLATFORM_NS_DIR} 161) 162 163install(FILES target_cfg.h 164 Libraries/mt25ql_flash_lib.h 165 tfm_peripherals_def.h 166 Device/Config/device_cfg.h 167 ${PLATFORM_DIR}/ext/target/arm/drivers/usart/pl011/uart_pl011_drv.h 168 ${PLATFORM_DIR}/ext/accelerator/cc312/crypto_accelerator_config.h 169 ${PLATFORM_DIR}/include/tfm_plat_defs.h 170 DESTINATION ${INSTALL_PLATFORM_NS_DIR}/include 171) 172 173install(DIRECTORY Device/Include 174 Device/Source 175 DESTINATION ${INSTALL_PLATFORM_NS_DIR}/Device 176) 177 178install(FILES ${PLATFORM_DIR}/ext/driver/Driver_Common.h 179 ${PLATFORM_DIR}/ext/driver/Driver_Flash.h 180 ${PLATFORM_DIR}/ext/driver/Driver_USART.h 181 DESTINATION ${INSTALL_PLATFORM_NS_DIR}/include) 182 183# copy all files from active platform directory 184install(DIRECTORY ${TARGET_PLATFORM_PATH}/ns/ 185 DESTINATION ${INSTALL_PLATFORM_NS_DIR}) 186 187install(FILES ${TARGET_PLATFORM_PATH}/cpuarch.cmake 188 ${TARGET_PLATFORM_PATH}/config.cmake 189 DESTINATION ${INSTALL_PLATFORM_NS_DIR}) 190 191# Install linker scripts 192install(FILES ${PLATFORM_DIR}/ext/common/armclang/tfm_common_ns.sct 193 ${PLATFORM_DIR}/ext/common/gcc/tfm_common_ns.ld 194 ${PLATFORM_DIR}/ext/common/iar/tfm_common_ns.icf 195 DESTINATION ${INSTALL_PLATFORM_NS_DIR}/linker_scripts) 196 197# Install test configs 198install(DIRECTORY ${TARGET_PLATFORM_PATH}/tests 199 DESTINATION ${INSTALL_PLATFORM_NS_DIR}) 200