diff options
author | Per Åstrand <per.astrand@arm.com> | 2020-11-27 19:47:58 +0100 |
---|---|---|
committer | Per Astrand <per.astrand@arm.com> | 2021-01-12 14:47:59 +0000 |
commit | 19a22ae956106af50bab9ab85efe9d488bbaff87 (patch) | |
tree | d3aaa4dfc592cc6797d77c361a0935a639a48ff4 /cmsis.cmake | |
parent | 97906ebb4687efee3678f2cbaf01ce881573d849 (diff) | |
download | ethos-u-core-software-19a22ae956106af50bab9ab85efe9d488bbaff87.tar.gz |
Adapt cmsis build for secure/nonsecure worlds
Add external include path to get the device specific partion header
file to setup SAU as needed by cmsis startup and make sure system
isn't build if we are targeting nonsecure world.
Change-Id: Ic9a9e380aa2bc41e6d1cd7f71c6713d033065c7a
Diffstat (limited to 'cmsis.cmake')
-rw-r--r-- | cmsis.cmake | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/cmsis.cmake b/cmsis.cmake index 4615c58..9322240 100644 --- a/cmsis.cmake +++ b/cmsis.cmake @@ -43,15 +43,41 @@ target_include_directories(cmsis_core INTERFACE ${CMSIS_PATH}/CMSIS/Core/Include # CMSIS device add_library(cmsis_device INTERFACE) target_include_directories(cmsis_device INTERFACE ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Include) +if (TRUSTZONE_BUILD) + # Use Cortex-M Secure Extension when compiling + target_compile_options(cmsis_device INTERFACE -mcmse) + target_compile_definitions(cmsis_device INTERFACE TRUSTZONE_BUILD) + if (TRUSTZONE_SIDE STREQUAL secure) + target_compile_definitions(cmsis_device INTERFACE TRUSTZONE_SECURE) + else() + target_compile_definitions(cmsis_device INTERFACE TRUSTZONE_NONSECURE) + endif() +endif() target_compile_options(cmsis_device INTERFACE -include${ARM_CPU}${ARM_FEATURES}.h) target_link_libraries(cmsis_device INTERFACE cmsis_core) # CMSIS startup -add_library(cmsis_startup STATIC - ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/startup_${ARM_CPU}.c - ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/system_${ARM_CPU}.c) +add_library(cmsis_startup STATIC) +if (TRUSTZONE_BUILD) + if (TRUSTZONE_SIDE STREQUAL secure) + target_sources(cmsis_startup PRIVATE + ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/startup_${ARM_CPU}.c + ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/system_${ARM_CPU}.c) + # Bring in the partion header + target_include_directories(cmsis_startup PRIVATE ${TRUSTZONE_PARTITION_DIRECTORY}) + elseif(TRUSTZONE_SIDE STREQUAL nonsecure) + target_sources(cmsis_startup PRIVATE + ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/startup_${ARM_CPU}.c) + endif() +else() + target_sources(cmsis_startup PRIVATE + ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/startup_${ARM_CPU}.c + ${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/system_${ARM_CPU}.c) +endif() + set_source_files_properties(${CMSIS_PATH}/Device/ARM/${ARM_CPU}/Source/startup_${ARM_CPU}.c PROPERTIES COMPILE_FLAGS -Wno-redundant-decls) + target_compile_definitions(cmsis_startup PRIVATE ${ARM_CPU}${ARM_FEATURES}) target_link_libraries(cmsis_startup PRIVATE cmsis_device) |