1# 2# Copyright (c) 2021 Nordic Semiconductor ASA 3# 4# SPDX-License-Identifier: Apache-2.0 5# 6 7cmake_minimum_required(VERSION 3.20.0) 8 9find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) 10 11project(tfm_regression_test) 12 13target_sources(app PRIVATE src/main.c) 14 15get_target_property(TFM_BINARY_DIR tfm TFM_BINARY_DIR) 16get_target_property(TFM_NS_BIN_FILE tfm TFM_NS_BIN_FILE) 17get_target_property(TFM_NS_HEX_FILE tfm TFM_NS_HEX_FILE) 18get_target_property(TFM_NS_SIGNED_BIN_FILE tfm TFM_NS_SIGNED_BIN_FILE) 19 20get_target_property(TFM_TOOLCHAIN_PATH tfm TFM_TOOLCHAIN_PATH) 21get_target_property(TFM_TOOLCHAIN_PREFIX tfm TFM_TOOLCHAIN_PREFIX) 22get_target_property(TFM_TOOLCHAIN_NS_FILE tfm TFM_TOOLCHAIN_NS_FILE) 23 24set(TFM_TEST_REPO_PATH ${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/../tf-m-tests) 25 26set(TFM_TEST_DIR "${TFM_TEST_REPO_PATH}/tests_reg/test/secure_regression") 27set(TFM_TEST_CONFIG_FILE "${TFM_TEST_REPO_PATH}/tests_reg/test/config/config.cmake") 28 29set_property(TARGET zephyr_property_target 30 APPEND PROPERTY TFM_CMAKE_OPTIONS 31 -DCONFIG_TFM_TEST_DIR=${TFM_TEST_DIR} 32) 33 34set_property(TARGET zephyr_property_target 35 APPEND PROPERTY TFM_CMAKE_OPTIONS 36 -DCONFIG_TFM_TEST_CONFIG_FILE=${TFM_TEST_CONFIG_FILE} 37) 38 39include(ExternalProject) 40 41ExternalProject_Add(tfm_regression_test_app 42 SOURCE_DIR ${TFM_TEST_REPO_PATH}/tests_reg 43 BINARY_DIR ${PROJECT_BINARY_DIR}/tfm_ns 44 CONFIGURE_COMMAND 45 ${CMAKE_COMMAND} 46 -G ${CMAKE_GENERATOR} 47 -S ${TFM_TEST_REPO_PATH}/tests_reg 48 -B ${PROJECT_BINARY_DIR}/tfm_ns 49 -DCONFIG_SPE_PATH=${TFM_BINARY_DIR}/api_ns 50 -DTFM_TOOLCHAIN_FILE=cmake/${TFM_TOOLCHAIN_NS_FILE} 51 -DCROSS_COMPILE=${TFM_TOOLCHAIN_PATH}/${TFM_TOOLCHAIN_PREFIX} 52 -DQCBOR_PATH${QCBOR_PATH_TYPE}=${CONFIG_TFM_QCBOR_PATH} 53 -DCMAKE_BUILD_TYPE=RelWithDebInfo 54 BUILD_COMMAND ${CMAKE_COMMAND} --build . 55 INSTALL_COMMAND "" 56 BUILD_ALWAYS True 57 USES_TERMINAL_BUILD True 58 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tfm_ns 59 DEPENDS tfm 60 BUILD_BYPRODUCTS 61 ${TFM_NS_HEX_FILE} 62 ${TFM_NS_BIN_FILE} 63 ${TFM_NS_SIGNED_BIN_FILE} 64) 65 66add_dependencies(app tfm_regression_test_app) 67