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 build type config, setting options not already set
18string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE)
19include(${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake OPTIONAL)
20
21# Load platform config, setting options not already set
22include(${TARGET_PLATFORM_PATH}/config.cmake OPTIONAL)
23
24# Load profile config, setting options not already set
25if(TFM_PROFILE)
26    include(config/profile/${TFM_PROFILE}.cmake)
27endif()
28
29# Load TF-M model specific default config
30# Load IPC backend config if isolation level is explicitly specified to 2/3 or IPC backend is
31# selected via build command line. Otherwise, load SFN backend config by default.
32# If a pair of invalid settings are passed via command line, it will be captured later via config
33# check.
34# Also select IPC model by default for multi-core platforms that enable TrustZone.
35if((DEFINED TFM_ISOLATION_LEVEL AND TFM_ISOLATION_LEVEL GREATER 1) OR
36   (CONFIG_TFM_SPM_BACKEND STREQUAL "IPC") OR
37   (TFM_MULTI_CORE_TOPOLOGY AND CONFIG_TFM_USE_TRUSTZONE))
38    include(config/tfm_ipc_config_default.cmake)
39else()
40    #The default backend is SFN
41    include(config/tfm_sfn_config_default.cmake)
42endif()
43
44# Load bl1 config
45if(BL1 AND PLATFORM_DEFAULT_BL1)
46    include(${CMAKE_SOURCE_DIR}/bl1/config/bl1_config_default.cmake)
47endif()
48
49# Load MCUboot specific default.cmake
50if(NOT DEFINED BL2 OR BL2)
51    include(${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/mcuboot_default_config.cmake)
52endif()
53
54# Include FWU partition configs.
55include(config/tfm_fwu_config.cmake)
56
57# Include coprocessor configs
58include(config/cp_config_default.cmake)
59
60# Set secure log configs
61# It also depends on regression test config.
62include(config/tfm_secure_log.cmake)
63