Skip to content

Commit 3821932

Browse files
joerchanVge0rge
authored andcommitted
[nrf fromtree] tfm: Update TF-M regression tests sample to build NS app
Update the TF-M regression tests sample to build the NS app in the tf-m-tests repository as an external project. The regression tests need to provide test configurations to both TF-M an NS app. Duplicate configuration done in the spe/CMakeLists.txt to configure TF-M image for the regression tests. Signed-off-by: Joakim Andersson <[email protected]> Signed-off-by: Markus Swarowsky <[email protected]> (cherry picked from commit f48467a) Signed-off-by: Markus Swarowsky <[email protected]>
1 parent e64df3f commit 3821932

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

modules/trusted-firmware-m/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ if (CONFIG_BUILD_WITH_TFM)
4040
endif()
4141
if (CONFIG_TFM_REGRESSION_S)
4242
list(APPEND TFM_CMAKE_ARGS -DTEST_S=ON)
43+
list(APPEND TFM_CMAKE_ARGS -DTFM_S_REG_TEST:BOOL=ON)
4344
endif()
4445
if (CONFIG_TFM_REGRESSION_NS)
4546
list(APPEND TFM_CMAKE_ARGS -DTEST_NS=ON)
47+
list(APPEND TFM_CMAKE_ARGS -DTFM_NS_REG_TEST:BOOL=ON)
4648
endif()
4749
if (CONFIG_TFM_BL2)
4850
list(APPEND TFM_CMAKE_ARGS -DBL2=TRUE)

samples/tfm_integration/tfm_regression_test/CMakeLists.txt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,51 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
1111
project(tfm_regression_test)
1212

1313
target_sources(app PRIVATE src/main.c)
14+
15+
get_target_property(TFM_BINARY_DIR tfm TFM_BINARY_DIR)
16+
get_target_property(TFM_NS_BIN_FILE tfm TFM_NS_BIN_FILE)
17+
get_target_property(TFM_NS_HEX_FILE tfm TFM_NS_HEX_FILE)
18+
get_target_property(TFM_NS_SIGNED_BIN_FILE tfm TFM_NS_SIGNED_BIN_FILE)
19+
20+
set(TFM_TEST_REPO_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/../tf-m-tests)
21+
22+
set(TFM_TEST_DIR "${TFM_TEST_REPO_PATH}/tests_reg/test/secure_regression")
23+
set(TFM_TEST_CONFIG_FILE "${TFM_TEST_REPO_PATH}/tests_reg/test/config/config.cmake")
24+
25+
set_property(TARGET zephyr_property_target
26+
APPEND PROPERTY TFM_CMAKE_OPTIONS
27+
-DCONFIG_TFM_TEST_DIR=${TFM_TEST_DIR}
28+
)
29+
30+
set_property(TARGET zephyr_property_target
31+
APPEND PROPERTY TFM_CMAKE_OPTIONS
32+
-DCONFIG_TFM_TEST_CONFIG_FILE=${TFM_TEST_CONFIG_FILE}
33+
)
34+
35+
include(ExternalProject)
36+
37+
ExternalProject_Add(tfm_regression_test_app
38+
SOURCE_DIR ${TFM_TEST_REPO_PATH}/tests_reg
39+
BINARY_DIR ${PROJECT_BINARY_DIR}/tfm_ns
40+
CONFIGURE_COMMAND
41+
${CMAKE_COMMAND}
42+
-G ${CMAKE_GENERATOR}
43+
-S ${TFM_TEST_REPO_PATH}/tests_reg
44+
-B ${PROJECT_BINARY_DIR}/tfm_ns
45+
-DCONFIG_SPE_PATH=${TFM_BINARY_DIR}/api_ns
46+
-DTFM_TOOLCHAIN_FILE=cmake/toolchain_ns_GNUARM.cmake
47+
-DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH}
48+
-DCMAKE_BUILD_TYPE=RelWithDebInfo
49+
BUILD_COMMAND ${CMAKE_COMMAND} --build .
50+
INSTALL_COMMAND ""
51+
BUILD_ALWAYS True
52+
USES_TERMINAL_BUILD True
53+
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tfm_ns
54+
DEPENDS tfm
55+
BUILD_BYPRODUCTS
56+
${TFM_NS_HEX_FILE}
57+
${TFM_NS_BIN_FILE}
58+
${TFM_NS_SIGNED_BIN_FILE}
59+
)
60+
61+
add_dependencies(app tfm_regression_test_app)

0 commit comments

Comments
 (0)