Skip to content

Commit 4c22554

Browse files
committed
CMake: Fix TFM targets build
Add linking time pre-processor macro DOMAIN_NS for TFM targets and TrustZone non secure targets.
1 parent 0e257b0 commit 4c22554

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

tools/cmake/toolchains/ARM.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,20 @@ function(mbed_set_toolchain_options target)
5353
TOOLCHAIN_ARM
5454
)
5555

56+
list(APPEND link_options
57+
"${MBED_STUDIO_ARM_COMPILER}"
58+
)
59+
60+
# Add linking time preprocessor macro for TFM targets
61+
if(MBED_CPU_CORE MATCHES "\-NS$")
62+
list(APPEND link_options
63+
"--predefine=\"-DDOMAIN_NS=0x1\""
64+
)
65+
endif()
66+
5667
target_link_options(${target}
5768
PUBLIC
58-
${MBED_STUDIO_ARM_COMPILER}
69+
${link_options}
5970
)
6071
endfunction()
6172

tools/cmake/toolchains/GCC_ARM.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ function(mbed_set_toolchain_options target)
2323
"-T" "${CMAKE_BINARY_DIR}/${APP_TARGET}.link_script.ld"
2424
)
2525

26+
# Add linking time preprocessor macro for TFM targets
27+
if("TFM" IN_LIST MBED_TARGET_LABELS)
28+
list(APPEND link_options
29+
"-DDOMAIN_NS=1"
30+
)
31+
endif()
32+
2633
list(APPEND common_options
2734
"-Wall"
2835
"-Wextra"
@@ -49,6 +56,7 @@ function(mbed_set_toolchain_options target)
4956
TOOLCHAIN_GCC
5057
)
5158

59+
5260
target_link_options(${target}
5361
PUBLIC
5462
${common_options}

0 commit comments

Comments
 (0)