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

View file

@ -40,9 +40,11 @@ if (CONFIG_BUILD_WITH_TFM)
endif()
if (CONFIG_TFM_REGRESSION_S)
list(APPEND TFM_CMAKE_ARGS -DTEST_S=ON)
list(APPEND TFM_CMAKE_ARGS -DTFM_S_REG_TEST:BOOL=ON)
endif()
if (CONFIG_TFM_REGRESSION_NS)
list(APPEND TFM_CMAKE_ARGS -DTEST_NS=ON)
list(APPEND TFM_CMAKE_ARGS -DTFM_NS_REG_TEST:BOOL=ON)
endif()
if (CONFIG_TFM_BL2)
list(APPEND TFM_CMAKE_ARGS -DBL2=TRUE)

View file

@ -11,3 +11,51 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(tfm_regression_test)
target_sources(app PRIVATE src/main.c)
get_target_property(TFM_BINARY_DIR tfm TFM_BINARY_DIR)
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)
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")
set(TFM_TEST_CONFIG_FILE "${TFM_TEST_REPO_PATH}/tests_reg/test/config/config.cmake")
set_property(TARGET zephyr_property_target
APPEND PROPERTY TFM_CMAKE_OPTIONS
-DCONFIG_TFM_TEST_DIR=${TFM_TEST_DIR}
)
set_property(TARGET zephyr_property_target
APPEND PROPERTY TFM_CMAKE_OPTIONS
-DCONFIG_TFM_TEST_CONFIG_FILE=${TFM_TEST_CONFIG_FILE}
)
include(ExternalProject)
ExternalProject_Add(tfm_regression_test_app
SOURCE_DIR ${TFM_TEST_REPO_PATH}/tests_reg
BINARY_DIR ${PROJECT_BINARY_DIR}/tfm_ns
CONFIGURE_COMMAND
${CMAKE_COMMAND}
-G ${CMAKE_GENERATOR}
-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
-DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH}
-DCMAKE_BUILD_TYPE=RelWithDebInfo
BUILD_COMMAND ${CMAKE_COMMAND} --build .
INSTALL_COMMAND ""
BUILD_ALWAYS True
USES_TERMINAL_BUILD True
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tfm_ns
DEPENDS tfm
BUILD_BYPRODUCTS
${TFM_NS_HEX_FILE}
${TFM_NS_BIN_FILE}
${TFM_NS_SIGNED_BIN_FILE}
)
add_dependencies(app tfm_regression_test_app)