1#------------------------------------------------------------------------------- 2# Copyright (c) 2020-2023, 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 ===============================# 12target_include_directories(platform_region_defs 13 INTERFACE 14 partition 15) 16 17#========================= Platform common defs ===============================# 18 19# Specify the location of platform specific build dependencies. 20target_sources(tfm_s 21 PRIVATE 22 ${CMAKE_CURRENT_SOURCE_DIR}/cmsis_core/startup_an519.c 23) 24target_add_scatter_file(tfm_s 25 $<$<C_COMPILER_ID:ARMClang>:${PLATFORM_DIR}/ext/common/armclang/tfm_common_s.sct> 26 $<$<C_COMPILER_ID:GNU>:${PLATFORM_DIR}/ext/common/gcc/tfm_common_s.ld> 27 $<$<C_COMPILER_ID:IAR>:${PLATFORM_DIR}/ext/common/iar/tfm_common_s.icf> 28) 29 30if(BL2) 31 target_sources(bl2 32 PRIVATE 33 ${CMAKE_CURRENT_SOURCE_DIR}/cmsis_core/startup_an519.c 34 ) 35 target_add_scatter_file(bl2 36 $<$<C_COMPILER_ID:ARMClang>:${PLATFORM_DIR}/ext/common/armclang/tfm_common_bl2.sct> 37 $<$<C_COMPILER_ID:GNU>:${PLATFORM_DIR}/ext/common/gcc/tfm_common_bl2.ld> 38 $<$<C_COMPILER_ID:IAR>:${PLATFORM_DIR}/ext/common/iar/tfm_common_bl2.icf> 39 ) 40endif() 41 42#========================= Platform Secure ====================================# 43 44target_include_directories(platform_s 45 PUBLIC 46 . 47 ../common 48 cmsis_drivers 49 native_drivers 50 partition 51 retarget 52 cmsis_core 53 native_drivers/timer_cmsdk 54 ${PLATFORM_DIR}/.. 55) 56 57target_sources(platform_s 58 PRIVATE 59 cmsis_drivers/Driver_Flash.c 60 cmsis_drivers/Driver_MPC.c 61 cmsis_drivers/Driver_PPC.c 62 cmsis_drivers/Driver_USART.c 63 retarget/platform_retarget_dev.c 64 cmsis_core/system_core_init.c 65 native_drivers/mpc_sie200_drv.c 66 native_drivers/mpu_armv8m_drv.c 67 native_drivers/ppc_sse200_drv.c 68 native_drivers/ppc_sse200_drv.c 69 native_drivers/arm_uart_drv.c 70 $<$<AND:$<NOT:$<BOOL:${TFM_PARTITION_SLIH_TEST}>>,$<NOT:$<BOOL:${TFM_PARTITION_FLIH_TEST}>>>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/timer_cmsdk/timer_cmsdk.c> 71 $<$<OR:$<BOOL:${TFM_S_REG_TEST}>,$<BOOL:${TFM_NS_REG_TEST}>>:${CMAKE_CURRENT_SOURCE_DIR}/plat_test.c> 72 $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/services/src/tfm_platform_system.c> 73) 74 75target_sources(tfm_sprt 76 PRIVATE 77 # SLIH test Partition and FLIH test Partition access the timer as ARoT Partitions. 78 # Put the driver to SPRT so that both SLIH and FLIH tests can access it. 79 $<$<OR:$<BOOL:${TFM_PARTITION_SLIH_TEST}>,$<BOOL:${TFM_PARTITION_FLIH_TEST}>>:${CMAKE_CURRENT_SOURCE_DIR}/native_drivers/timer_cmsdk/timer_cmsdk.c> 80) 81 82target_compile_options(platform_s 83 PUBLIC 84 ${COMPILER_CMSE_FLAG} 85) 86 87#========================= Platform BL2 =======================================# 88 89if(BL2) 90 target_sources(platform_bl2 91 PRIVATE 92 retarget/platform_retarget_dev.c 93 cmsis_core/system_core_init.c 94 cmsis_drivers/Driver_Flash.c 95 native_drivers/arm_uart_drv.c 96 cmsis_drivers/Driver_USART.c 97 ) 98 99 target_include_directories(platform_bl2 100 PUBLIC 101 partition 102 cmsis_core 103 retarget 104 PRIVATE 105 . 106 ${PLATFORM_DIR}/.. 107 native_drivers 108 native_drivers/timer_cmsdk 109 ) 110endif() 111 112#========================= tfm_spm ============================================# 113 114target_sources(tfm_spm 115 PRIVATE 116 target_cfg.c 117 tfm_hal_isolation.c 118 tfm_hal_platform.c 119 faults.c 120 $<$<OR:$<BOOL:${CONFIG_TFM_FLIH_API}>,$<BOOL:${CONFIG_TFM_SLIH_API}>>:${CMAKE_CURRENT_SOURCE_DIR}/tfm_interrupts.c> 121) 122 123#========================= Files for building NS platform =====================# 124 125install(FILES ${TARGET_PLATFORM_PATH}/native_drivers/arm_uart_drv.c 126 ${TARGET_PLATFORM_PATH}/native_drivers/timer_cmsdk/timer_cmsdk.c 127 ${TARGET_PLATFORM_PATH}/cmsis_drivers/Driver_USART.c 128 ${TARGET_PLATFORM_PATH}/retarget/platform_retarget_dev.c 129 DESTINATION ${INSTALL_PLATFORM_NS_DIR}) 130 131install(DIRECTORY ${TARGET_PLATFORM_PATH}/cmsis_core 132 ${TARGET_PLATFORM_PATH}/retarget 133 DESTINATION ${INSTALL_PLATFORM_NS_DIR}) 134 135install(DIRECTORY ${PLATFORM_DIR}/ext/driver 136 DESTINATION ${INSTALL_PLATFORM_NS_DIR}/include) 137 138install(FILES ${TARGET_PLATFORM_PATH}/native_drivers/arm_uart_drv.h 139 ${TARGET_PLATFORM_PATH}/native_drivers/timer_cmsdk/timer_cmsdk.h 140 ${TARGET_PLATFORM_PATH}/native_drivers/mpc_sie200_drv.h 141 ${TARGET_PLATFORM_PATH}/native_drivers/ppc_sse200_drv.h 142 ${TARGET_PLATFORM_PATH}/retarget/platform_retarget.h 143 ${TARGET_PLATFORM_PATH}/retarget/platform_retarget_pins.h 144 ${TARGET_PLATFORM_PATH}/target_cfg.h 145 ${TARGET_PLATFORM_PATH}/device_cfg.h 146 ${TARGET_PLATFORM_PATH}/tfm_peripherals_def.h 147 ${TARGET_PLATFORM_PATH}/cmsis_driver_config.h 148 ${TARGET_PLATFORM_PATH}/RTE_Device.h 149 ${PLATFORM_DIR}/ext/driver/Driver_USART.h 150 ${PLATFORM_DIR}/ext/driver/Driver_Common.h 151 ${PLATFORM_DIR}/include/tfm_plat_defs.h 152 ${CMAKE_SOURCE_DIR}/lib/fih/inc/fih.h 153 DESTINATION ${INSTALL_PLATFORM_NS_DIR}/include) 154 155install(DIRECTORY ${TARGET_PLATFORM_PATH}/partition 156 DESTINATION ${INSTALL_PLATFORM_NS_DIR}) 157 158# copy all files from active platform directory 159install(DIRECTORY ${TARGET_PLATFORM_PATH}/ns/ 160 DESTINATION ${INSTALL_PLATFORM_NS_DIR}) 161 162install(FILES ${TARGET_PLATFORM_PATH}/cpuarch.cmake 163 ${TARGET_PLATFORM_PATH}/config.cmake 164 DESTINATION ${INSTALL_PLATFORM_NS_DIR}) 165 166install(FILES ${PLATFORM_DIR}/ext/common/gcc/tfm_common_ns.ld 167 ${PLATFORM_DIR}/ext/common/armclang/tfm_common_ns.sct 168 ${PLATFORM_DIR}/ext/common/iar/tfm_common_ns.icf 169 DESTINATION ${INSTALL_PLATFORM_NS_DIR}/linker_scripts) 170 171# Install test configs 172install(DIRECTORY ${TARGET_PLATFORM_PATH}/tests 173 DESTINATION ${INSTALL_PLATFORM_NS_DIR}) 174