1#------------------------------------------------------------------------------- 2# Copyright (c) 2023, Arm Limited. All rights reserved. 3# 4# SPDX-License-Identifier: BSD-3-Clause 5# 6#------------------------------------------------------------------------------- 7 8# Load the default extra configs about generated files and secure partitions 9include(${CMAKE_SOURCE_DIR}/config/extra_build_config.cmake) 10 11if(CONFIG_TFM_TEST_CONFIG_FILE) 12 if(NOT IS_ABSOLUTE "${CONFIG_TFM_TEST_CONFIG_FILE}") 13 message(SEND_ERROR "CONFIG_TFM_TEST_CONFIG_FILE is not an absolute path:") 14 message(SEND_ERROR "${CONFIG_TFM_TEST_CONFIG_FILE}") 15 message(SEND_ERROR "Configuration might fail.") 16 endif() 17 18 # Include platform specific regression tests preference at first 19 include(${TARGET_PLATFORM_PATH}/tests/tfm_tests_config.cmake OPTIONAL) 20 # Then include the test configuration specified by users 21 include(${CONFIG_TFM_TEST_CONFIG_FILE}) 22endif() 23 24if(CONFIG_PSA_ARCH_TESTS_CONFIG_FILE) 25 if(NOT IS_ABSOLUTE "${CONFIG_PSA_ARCH_TESTS_CONFIG_FILE}") 26 message(SEND_ERROR "CONFIG_PSA_ARCH_TESTS_CONFIG_FILE is not an absolute path:") 27 message(SEND_ERROR "${CONFIG_PSA_ARCH_TESTS_CONFIG_FILE}") 28 message(SEND_ERROR "Configuration might fail.") 29 endif() 30 31 # Include platform specific psa arch tests preference at first 32 include(${TARGET_PLATFORM_PATH}/tests/psa_arch_tests_config.cmake OPTIONAL) 33 # Then include the test configuration specified by users 34 include(${CONFIG_PSA_ARCH_TESTS_CONFIG_FILE}) 35endif() 36 37# Load defaults, setting options not already set 38include(config/config_base.cmake) 39 40# Build system log config 41include(${CMAKE_SOURCE_DIR}/config/tfm_build_log_config.cmake) 42 43# The library to collect compile definitions of config options. 44add_library(tfm_config INTERFACE) 45 46target_compile_definitions(tfm_config 47 INTERFACE 48 $<$<STREQUAL:${TEST_PSA_API},CRYPTO>:PSA_API_TEST_CRYPTO> 49 $<$<STREQUAL:${TEST_PSA_API},IPC>:PSA_API_TEST_IPC> 50) 51 52# Set user defined TF-M config header file 53if(PROJECT_CONFIG_HEADER_FILE) 54 if(NOT EXISTS ${PROJECT_CONFIG_HEADER_FILE}) 55 message(FATAL_ERROR "${PROJECT_CONFIG_HEADER_FILE} does not exist! Please use absolute path.") 56 endif() 57 target_compile_definitions(tfm_config 58 INTERFACE 59 PROJECT_CONFIG_HEADER_FILE="${PROJECT_CONFIG_HEADER_FILE}" 60 ) 61endif() 62 63# Set platform defined TF-M config header file 64set(TARGET_CONFIG_HEADER_FILE ${TARGET_PLATFORM_PATH}/config_tfm_target.h) 65if(EXISTS ${TARGET_CONFIG_HEADER_FILE}) 66 target_compile_definitions(tfm_config 67 INTERFACE 68 TARGET_CONFIG_HEADER_FILE="${TARGET_CONFIG_HEADER_FILE}" 69 ) 70endif() 71 72target_include_directories(tfm_config 73 INTERFACE 74 $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> 75) 76