blob: 68728201b57f3f407238dbda2591de08fa516eec [file] [log] [blame]
Kevin Pengd0e49712022-12-07 11:13:01 +08001#-------------------------------------------------------------------------------
2# Copyright (c) 2023, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
Kevin Pengb308c342023-04-04 10:52:24 +08008# Load defaults, setting options not already set
9include(config/config_base.cmake)
10
11# Load regression configs overrided by platform
12if(EXISTS ${TARGET_PLATFORM_PATH}/reg_config_override.cmake)
13 include(${TARGET_PLATFORM_PATH}/reg_config_override.cmake)
14endif()
15
Kevin Pengd0e49712022-12-07 11:13:01 +080016# Fetch tf-m-tests repo during config, if NS or regression test is required.
17# Therefore tf-m-tests configs can be set with TF-M configs since their configs
18# are coupled.
19include(lib/ext/tf-m-tests/fetch_repo.cmake)
20
21# Load TF-M regression test suites setting
Kevin Pengb9c99f02022-12-07 11:23:17 +080022if(NOT USE_KCONFIG_TOOL AND (TFM_NS_REG_TEST OR TFM_S_REG_TEST))
Kevin Pengd0e49712022-12-07 11:13:01 +080023 include(${TFM_TEST_PATH}/config/set_config.cmake)
24endif()
25
26# Build system log config
27include(${CMAKE_SOURCE_DIR}/config/tfm_build_log_config.cmake)
28
29# The library to collect compile definitions of config options.
30add_library(tfm_config INTERFACE)
31
32target_compile_definitions(tfm_config
33 INTERFACE
Kevin Pengf6721c72023-03-01 16:12:45 +080034 $<$<STREQUAL:${TEST_PSA_API},CRYPTO>:PSA_API_TEST_CRYPTO>
35 $<$<STREQUAL:${TEST_PSA_API},IPC>:PSA_API_TEST_IPC>
Kevin Pengd0e49712022-12-07 11:13:01 +080036)
37
38# Set user defined TF-M config header file
39if(PROJECT_CONFIG_HEADER_FILE)
40 if(NOT EXISTS ${PROJECT_CONFIG_HEADER_FILE})
41 message(FATAL_ERROR "${PROJECT_CONFIG_HEADER_FILE} does not exist! Please use absolute path.")
42 endif()
43 target_compile_definitions(tfm_config
44 INTERFACE
45 PROJECT_CONFIG_HEADER_FILE="${PROJECT_CONFIG_HEADER_FILE}"
46 )
47endif()
48
49# Set platform defined TF-M config header file
50set(TARGET_CONFIG_HEADER_FILE ${TARGET_PLATFORM_PATH}/config_tfm_target.h)
51if(EXISTS ${TARGET_CONFIG_HEADER_FILE})
52 target_compile_definitions(tfm_config
53 INTERFACE
54 TARGET_CONFIG_HEADER_FILE="${TARGET_CONFIG_HEADER_FILE}"
55 )
56endif()
David Hu6d1a9b62023-02-22 16:54:04 +080057
58target_include_directories(tfm_config
59 INTERFACE
60 ${CMAKE_CURRENT_LIST_DIR}
61)