Skip to content

Commit

Permalink
tfm: Provide properties for selected TF-M toolchain for NS application
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joakim Andersson authored and mswarowsky committed Jan 15, 2024
1 parent c3d3216 commit f442dc2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions modules/trusted-firmware-m/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion samples/tfm_integration/tfm_regression_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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 .
Expand Down

0 comments on commit f442dc2

Please sign in to comment.