Kevin Peng | d0e4971 | 2022-12-07 11:13:01 +0800 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2023, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
Jianliang Shen | 412d875 | 2023-08-16 11:23:05 +0800 | [diff] [blame] | 8 | # Load the default extra configs about generated files and secure partitions |
| 9 | include(${CMAKE_SOURCE_DIR}/config/extra_build_config.cmake) |
| 10 | |
Kevin Peng | b308c34 | 2023-04-04 10:52:24 +0800 | [diff] [blame] | 11 | # Load defaults, setting options not already set |
| 12 | include(config/config_base.cmake) |
| 13 | |
| 14 | # Load regression configs overrided by platform |
Kevin Peng | 174f836 | 2023-04-07 11:32:16 +0800 | [diff] [blame] | 15 | include(${TARGET_PLATFORM_PATH}/reg_config_override.cmake OPTIONAL) |
Kevin Peng | b308c34 | 2023-04-04 10:52:24 +0800 | [diff] [blame] | 16 | |
Kevin Peng | d0e4971 | 2022-12-07 11:13:01 +0800 | [diff] [blame] | 17 | # Fetch tf-m-tests repo during config, if NS or regression test is required. |
| 18 | # Therefore tf-m-tests configs can be set with TF-M configs since their configs |
| 19 | # are coupled. |
| 20 | include(lib/ext/tf-m-tests/fetch_repo.cmake) |
| 21 | |
| 22 | # Load TF-M regression test suites setting |
Kevin Peng | b9c99f0 | 2022-12-07 11:23:17 +0800 | [diff] [blame] | 23 | if(NOT USE_KCONFIG_TOOL AND (TFM_NS_REG_TEST OR TFM_S_REG_TEST)) |
Kevin Peng | d0e4971 | 2022-12-07 11:13:01 +0800 | [diff] [blame] | 24 | include(${TFM_TEST_PATH}/config/set_config.cmake) |
| 25 | endif() |
| 26 | |
| 27 | # Build system log config |
| 28 | include(${CMAKE_SOURCE_DIR}/config/tfm_build_log_config.cmake) |
| 29 | |
| 30 | # The library to collect compile definitions of config options. |
| 31 | add_library(tfm_config INTERFACE) |
| 32 | |
| 33 | target_compile_definitions(tfm_config |
| 34 | INTERFACE |
Kevin Peng | f6721c7 | 2023-03-01 16:12:45 +0800 | [diff] [blame] | 35 | $<$<STREQUAL:${TEST_PSA_API},CRYPTO>:PSA_API_TEST_CRYPTO> |
| 36 | $<$<STREQUAL:${TEST_PSA_API},IPC>:PSA_API_TEST_IPC> |
Kevin Peng | d0e4971 | 2022-12-07 11:13:01 +0800 | [diff] [blame] | 37 | ) |
| 38 | |
| 39 | # Set user defined TF-M config header file |
| 40 | if(PROJECT_CONFIG_HEADER_FILE) |
| 41 | if(NOT EXISTS ${PROJECT_CONFIG_HEADER_FILE}) |
| 42 | message(FATAL_ERROR "${PROJECT_CONFIG_HEADER_FILE} does not exist! Please use absolute path.") |
| 43 | endif() |
| 44 | target_compile_definitions(tfm_config |
| 45 | INTERFACE |
| 46 | PROJECT_CONFIG_HEADER_FILE="${PROJECT_CONFIG_HEADER_FILE}" |
| 47 | ) |
| 48 | endif() |
| 49 | |
| 50 | # Set platform defined TF-M config header file |
| 51 | set(TARGET_CONFIG_HEADER_FILE ${TARGET_PLATFORM_PATH}/config_tfm_target.h) |
| 52 | if(EXISTS ${TARGET_CONFIG_HEADER_FILE}) |
| 53 | target_compile_definitions(tfm_config |
| 54 | INTERFACE |
| 55 | TARGET_CONFIG_HEADER_FILE="${TARGET_CONFIG_HEADER_FILE}" |
| 56 | ) |
| 57 | endif() |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 58 | |
| 59 | target_include_directories(tfm_config |
| 60 | INTERFACE |
| 61 | ${CMAKE_CURRENT_LIST_DIR} |
| 62 | ) |