Skip to content

Commit 5a13fed

Browse files
joerchanVge0rge
authored andcommitted
[nrf fromtree] tfm: Provide properties for selected TF-M toolchain for NS application
Provide properties for selected TF-M toolchain so that the NS application will use the same toolchain as TF-M. Signed-off-by: Joakim Andersson <[email protected]> Signed-off-by: Markus Swarowsky <[email protected]> (cherry picked from commit 3a83043) Signed-off-by: Markus Swarowsky <[email protected]>
1 parent 6579348 commit 5a13fed

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

modules/trusted-firmware-m/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ if (CONFIG_BUILD_WITH_TFM)
228228
message(FATAL_ERROR "Unsupported ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT}")
229229
endif()
230230

231+
string(REPLACE "toolchain" "toolchain_ns" TFM_TOOLCHAIN_NS_FILE ${TFM_TOOLCHAIN_FILE})
232+
231233
if (CONFIG_TFM_QCBOR_PATH STREQUAL "DOWNLOAD")
232234
# Change CMake cache type to string to avoid QCBOR_PATH=/absolute/path/DOWNLOAD being set.
233235
set(QCBOR_PATH_TYPE ":STRING")
@@ -317,6 +319,11 @@ if (CONFIG_BUILD_WITH_TFM)
317319
# This is the root of all TFM build artifacts.
318320
set_target_properties(tfm PROPERTIES TFM_BINARY_DIR ${TFM_BINARY_DIR})
319321

322+
# Set TFM toolchain properties on 'tfm'
323+
set_target_properties(tfm PROPERTIES TFM_TOOLCHAIN_NS_FILE ${TFM_TOOLCHAIN_NS_FILE})
324+
set_target_properties(tfm PROPERTIES TFM_TOOLCHAIN_PREFIX ${TFM_TOOLCHAIN_PREFIX})
325+
set_target_properties(tfm PROPERTIES TFM_TOOLCHAIN_PATH ${TFM_TOOLCHAIN_PATH})
326+
320327
# Set BL2 (MCUboot) executable file paths as target properties on 'tfm'
321328
# These files are produced by the TFM build system.
322329
if(CONFIG_TFM_BL2)

samples/tfm_integration/tfm_regression_test/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ get_target_property(TFM_NS_BIN_FILE tfm TFM_NS_BIN_FILE)
1717
get_target_property(TFM_NS_HEX_FILE tfm TFM_NS_HEX_FILE)
1818
get_target_property(TFM_NS_SIGNED_BIN_FILE tfm TFM_NS_SIGNED_BIN_FILE)
1919

20+
get_target_property(TFM_TOOLCHAIN_PATH tfm TFM_TOOLCHAIN_PATH)
21+
get_target_property(TFM_TOOLCHAIN_PREFIX tfm TFM_TOOLCHAIN_PREFIX)
22+
get_target_property(TFM_TOOLCHAIN_NS_FILE tfm TFM_TOOLCHAIN_NS_FILE)
23+
2024
set(TFM_TEST_REPO_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/../tf-m-tests)
2125

2226
set(TFM_TEST_DIR "${TFM_TEST_REPO_PATH}/tests_reg/test/secure_regression")
@@ -43,7 +47,8 @@ ExternalProject_Add(tfm_regression_test_app
4347
-S ${TFM_TEST_REPO_PATH}/tests_reg
4448
-B ${PROJECT_BINARY_DIR}/tfm_ns
4549
-DCONFIG_SPE_PATH=${TFM_BINARY_DIR}/api_ns
46-
-DTFM_TOOLCHAIN_FILE=cmake/toolchain_ns_GNUARM.cmake
50+
-DTFM_TOOLCHAIN_FILE=cmake/${TFM_TOOLCHAIN_NS_FILE}
51+
-DCROSS_COMPILE=${TFM_TOOLCHAIN_PATH}/${TFM_TOOLCHAIN_PREFIX}
4752
-DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH}
4853
-DCMAKE_BUILD_TYPE=RelWithDebInfo
4954
BUILD_COMMAND ${CMAKE_COMMAND} --build .

0 commit comments

Comments
 (0)