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 <joakim.andersson@nordicsemi.no>
Signed-off-by: Markus Swarowsky <markus.swarowsky@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2023-12-15 10:33:50 +01:00 committed by Carles Cufí
commit 3a830433be
2 changed files with 13 additions and 1 deletions

View file

@ -228,6 +228,8 @@ if (CONFIG_BUILD_WITH_TFM)
message(FATAL_ERROR "Unsupported ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT}")
endif()
string(REPLACE "toolchain" "toolchain_ns" TFM_TOOLCHAIN_NS_FILE ${TFM_TOOLCHAIN_FILE})
if (CONFIG_TFM_QCBOR_PATH STREQUAL "DOWNLOAD")
# Change CMake cache type to string to avoid QCBOR_PATH=/absolute/path/DOWNLOAD being set.
set(QCBOR_PATH_TYPE ":STRING")
@ -318,6 +320,11 @@ if (CONFIG_BUILD_WITH_TFM)
# This is the root of all TFM build artifacts.
set_target_properties(tfm PROPERTIES TFM_BINARY_DIR ${TFM_BINARY_DIR})
# Set TFM toolchain properties on 'tfm'
set_target_properties(tfm PROPERTIES TFM_TOOLCHAIN_NS_FILE ${TFM_TOOLCHAIN_NS_FILE})
set_target_properties(tfm PROPERTIES TFM_TOOLCHAIN_PREFIX ${TFM_TOOLCHAIN_PREFIX})
set_target_properties(tfm PROPERTIES TFM_TOOLCHAIN_PATH ${TFM_TOOLCHAIN_PATH})
# Set BL2 (MCUboot) executable file paths as target properties on 'tfm'
# These files are produced by the TFM build system.
if(CONFIG_TFM_BL2)

View file

@ -17,6 +17,10 @@ get_target_property(TFM_NS_BIN_FILE tfm TFM_NS_BIN_FILE)
get_target_property(TFM_NS_HEX_FILE tfm TFM_NS_HEX_FILE)
get_target_property(TFM_NS_SIGNED_BIN_FILE tfm TFM_NS_SIGNED_BIN_FILE)
get_target_property(TFM_TOOLCHAIN_PATH tfm TFM_TOOLCHAIN_PATH)
get_target_property(TFM_TOOLCHAIN_PREFIX tfm TFM_TOOLCHAIN_PREFIX)
get_target_property(TFM_TOOLCHAIN_NS_FILE tfm TFM_TOOLCHAIN_NS_FILE)
set(TFM_TEST_REPO_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/../tf-m-tests)
set(TFM_TEST_DIR "${TFM_TEST_REPO_PATH}/tests_reg/test/secure_regression")
@ -43,7 +47,8 @@ ExternalProject_Add(tfm_regression_test_app
-S ${TFM_TEST_REPO_PATH}/tests_reg
-B ${PROJECT_BINARY_DIR}/tfm_ns
-DCONFIG_SPE_PATH=${TFM_BINARY_DIR}/api_ns
-DTFM_TOOLCHAIN_FILE=cmake/toolchain_ns_GNUARM.cmake
-DTFM_TOOLCHAIN_FILE=cmake/${TFM_TOOLCHAIN_NS_FILE}
-DCROSS_COMPILE=${TFM_TOOLCHAIN_PATH}/${TFM_TOOLCHAIN_PREFIX}
-DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH}
-DCMAKE_BUILD_TYPE=RelWithDebInfo
BUILD_COMMAND ${CMAKE_COMMAND} --build .