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 | |
Kevin Peng | b308c34 | 2023-04-04 10:52:24 +0800 | [diff] [blame^] | 8 | # Load defaults, setting options not already set |
| 9 | include(config/config_base.cmake) |
| 10 | |
| 11 | # Load regression configs overrided by platform |
| 12 | if(EXISTS ${TARGET_PLATFORM_PATH}/reg_config_override.cmake) |
| 13 | include(${TARGET_PLATFORM_PATH}/reg_config_override.cmake) |
| 14 | endif() |
| 15 | |
Kevin Peng | d0e4971 | 2022-12-07 11:13:01 +0800 | [diff] [blame] | 16 | # 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. |
| 19 | include(lib/ext/tf-m-tests/fetch_repo.cmake) |
| 20 | |
| 21 | # Load TF-M regression test suites setting |
Kevin Peng | b9c99f0 | 2022-12-07 11:23:17 +0800 | [diff] [blame] | 22 | 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] | 23 | include(${TFM_TEST_PATH}/config/set_config.cmake) |
| 24 | endif() |
| 25 | |
| 26 | # Build system log config |
| 27 | include(${CMAKE_SOURCE_DIR}/config/tfm_build_log_config.cmake) |
| 28 | |
| 29 | # The library to collect compile definitions of config options. |
| 30 | add_library(tfm_config INTERFACE) |
| 31 | |
| 32 | target_compile_definitions(tfm_config |
| 33 | INTERFACE |
Kevin Peng | f6721c7 | 2023-03-01 16:12:45 +0800 | [diff] [blame] | 34 | $<$<STREQUAL:${TEST_PSA_API},CRYPTO>:PSA_API_TEST_CRYPTO> |
| 35 | $<$<STREQUAL:${TEST_PSA_API},IPC>:PSA_API_TEST_IPC> |
Kevin Peng | d0e4971 | 2022-12-07 11:13:01 +0800 | [diff] [blame] | 36 | ) |
| 37 | |
| 38 | # Set user defined TF-M config header file |
| 39 | if(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 | ) |
| 47 | endif() |
| 48 | |
| 49 | # Set platform defined TF-M config header file |
| 50 | set(TARGET_CONFIG_HEADER_FILE ${TARGET_PLATFORM_PATH}/config_tfm_target.h) |
| 51 | if(EXISTS ${TARGET_CONFIG_HEADER_FILE}) |
| 52 | target_compile_definitions(tfm_config |
| 53 | INTERFACE |
| 54 | TARGET_CONFIG_HEADER_FILE="${TARGET_CONFIG_HEADER_FILE}" |
| 55 | ) |
| 56 | endif() |
David Hu | 6d1a9b6 | 2023-02-22 16:54:04 +0800 | [diff] [blame] | 57 | |
| 58 | target_include_directories(tfm_config |
| 59 | INTERFACE |
| 60 | ${CMAKE_CURRENT_LIST_DIR} |
| 61 | ) |