CMake: Fix TFM targets build

Add linking time pre-processor macro DOMAIN_NS
for TFM targets and TrustZone non secure targets.
pull/13566/head
Hugues Kamba 2020-09-17 16:28:06 +01:00
parent 0e257b0730
commit 4c22554bed
2 changed files with 20 additions and 1 deletions

View File

@ -53,9 +53,20 @@ function(mbed_set_toolchain_options target)
TOOLCHAIN_ARM
)
list(APPEND link_options
"${MBED_STUDIO_ARM_COMPILER}"
)
# Add linking time preprocessor macro for TFM targets
if(MBED_CPU_CORE MATCHES "\-NS$")
list(APPEND link_options
"--predefine=\"-DDOMAIN_NS=0x1\""
)
endif()
target_link_options(${target}
PUBLIC
${MBED_STUDIO_ARM_COMPILER}
${link_options}
)
endfunction()

View File

@ -23,6 +23,13 @@ function(mbed_set_toolchain_options target)
"-T" "${CMAKE_BINARY_DIR}/${APP_TARGET}.link_script.ld"
)
# Add linking time preprocessor macro for TFM targets
if("TFM" IN_LIST MBED_TARGET_LABELS)
list(APPEND link_options
"-DDOMAIN_NS=1"
)
endif()
list(APPEND common_options
"-Wall"
"-Wextra"
@ -49,6 +56,7 @@ function(mbed_set_toolchain_options target)
TOOLCHAIN_GCC
)
target_link_options(${target}
PUBLIC
${common_options}