1#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2023, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8# The Configuration sequence is captured in the documentation, in
9# docs/getting_started/tfm_build_instructions.rst under Cmake Configuration. If
10# the sequence is updated here the docs must also be updated.
11
12# Load extra config
13if(TFM_EXTRA_CONFIG_PATH)
14    include(${TFM_EXTRA_CONFIG_PATH})
15endif()
16
17# Load PSA config, setting options not already set
18if(TEST_PSA_API)
19    include(config/tests/config_test_psa_api.cmake)
20endif()
21
22# Load build type config, setting options not already set
23string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE)
24include(${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake OPTIONAL)
25
26# Load platform config, setting options not already set
27include(${TARGET_PLATFORM_PATH}/config.cmake OPTIONAL)
28
29# Parse tf-m-tests config prior to platform specific config.cmake
30# Some platforms select different configuration according when regression tests
31# are enabled.
32include(lib/ext/tf-m-tests/reg_parse.cmake)
33
34# Load profile config, setting options not already set
35if(TFM_PROFILE)
36    include(config/profile/${TFM_PROFILE}.cmake)
37endif()
38
39# Load Secure Partition settings according to regression configuration as all SPs are disabled
40# by default
41if(TFM_S_REG_TEST OR TFM_NS_REG_TEST)
42    include(${CMAKE_CURRENT_LIST_DIR}/tests/regression_config.cmake)
43endif()
44
45# Load TF-M model specific default config
46# Load IPC backend config if isolation level is explicitly specified to 2/3 or IPC backend is
47# selected via build command line. Otherwise, load SFN backend config by default.
48# If a pair of invalid settings are passed via command line, it will be captured later via config
49# check.
50# Also select IPC model by default for multi-core platform unless it has already selected SFN model
51if((DEFINED TFM_ISOLATION_LEVEL AND TFM_ISOLATION_LEVEL GREATER 1) OR
52    CONFIG_TFM_SPM_BACKEND STREQUAL "IPC" OR
53    TFM_MULTI_CORE_TOPOLOGY)
54    include(config/tfm_ipc_config_default.cmake)
55else()
56    #The default backend is SFN
57    include(config/tfm_sfn_config_default.cmake)
58endif()
59
60# Load bl1 config
61if(BL1 AND PLATFORM_DEFAULT_BL1)
62    include(${CMAKE_SOURCE_DIR}/bl1/config/bl1_config_default.cmake)
63endif()
64
65# Load MCUboot specific default.cmake
66if(NOT DEFINED BL2 OR BL2)
67    include(${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/mcuboot_default_config.cmake)
68endif()
69
70# Include FWU partition configs.
71include(config/tfm_fwu_config.cmake)
72
73# Include coprocessor configs
74include(config/cp_config_default.cmake)
75
76# Set secure log configs
77# It also depends on regression test config.
78include(config/tfm_secure_log.cmake)
79