blob: 5f3d644bff70db051c6dd39896abf6a088cb3fab [file] [log] [blame]
Raef Coles958aeef2020-10-08 12:12:58 +01001#-------------------------------------------------------------------------------
Kevin Pengc32279d2022-02-10 11:11:55 +08002# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
Raef Coles958aeef2020-10-08 12:12:58 +01003#
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
Dávid Házie50f0a92022-07-06 14:46:01 +020012# The default build type is MinSizeRel. If debug symbols are needed then
13# -DCMAKE_BUILD_TYPE=debug should be used (likewise with other build types)
14if (NOT CMAKE_BUILD_TYPE)
15 set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Build type: [Debug, Release, RelWithDebInfo, MinSizeRel]" FORCE)
16endif()
17
Tamas Ban69219202020-10-27 08:13:18 +000018# Load extra config
19if (TFM_EXTRA_CONFIG_PATH)
20 include(${TFM_EXTRA_CONFIG_PATH})
21endif()
Raef Coles958aeef2020-10-08 12:12:58 +010022
Tamas Ban69219202020-10-27 08:13:18 +000023# Load PSA config, setting options not already set
24if (TEST_PSA_API)
25 include(config/tests/config_test_psa_api.cmake)
26endif()
27
28# Load build type config, setting options not already set
Raef Coles958aeef2020-10-08 12:12:58 +010029string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE)
30if (EXISTS ${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake)
31 include(${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake)
32endif()
33
David Hu195cb5a2022-05-10 22:03:26 +080034# Parse tf-m-tests config prior to platform specific config.cmake
35# Some platforms select different configuration according when regression tests
36# are enabled.
37include(lib/ext/tf-m-tests/pre_parse.cmake)
38
Tamas Ban69219202020-10-27 08:13:18 +000039# Load platform config, setting options not already set
Kevin Peng38800662021-07-14 10:28:23 +080040if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/config.cmake)
Tamas Ban69219202020-10-27 08:13:18 +000041 include(platform/ext/target/${TFM_PLATFORM}/config.cmake)
Raef Coles958aeef2020-10-08 12:12:58 +010042endif()
43
Tamas Ban69219202020-10-27 08:13:18 +000044# Load accelerator config, setting options not already set
45if (CRYPTO_HW_ACCELERATOR)
46 if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/accelerator/${CRYPTO_HW_ACCELERATOR_TYPE}/config.cmake)
47 include(${CMAKE_SOURCE_DIR}/platform/ext/accelerator/${CRYPTO_HW_ACCELERATOR_TYPE}/config.cmake)
48 endif()
49endif()
50
51# Load profile config, setting options not already set
Raef Coles958aeef2020-10-08 12:12:58 +010052if (TFM_PROFILE)
Tamas Ban69219202020-10-27 08:13:18 +000053 include(config/profile/${TFM_PROFILE}.cmake)
Raef Coles958aeef2020-10-08 12:12:58 +010054endif()
55
Kevin Pengc32279d2022-02-10 11:11:55 +080056include(${CMAKE_SOURCE_DIR}/config/tfm_build_log_config.cmake)
57
David Hu9b6a1fe2020-12-21 15:16:09 +080058# Load TF-M model specific default config
Kevin Peng23a583c2021-09-08 22:33:33 +080059if (TFM_LIB_MODEL)
60 include(config/tfm_library_config_default.cmake)
Kevin Peng76c0c162022-02-09 22:49:06 +080061elseif (CONFIG_TFM_SPM_BACKEND STREQUAL "SFN")
62 include(config/tfm_sfn_config_default.cmake)
63else() #The default backend is IPC
David Hu9b6a1fe2020-12-21 15:16:09 +080064 include(config/tfm_ipc_config_default.cmake)
65endif()
66
Raef Coles15a37f82021-12-07 15:59:14 +000067# Load bl1 config
Raef Colesd32f6bf2022-04-19 15:13:00 +010068if (BL1 AND PLATFORM_DEFAULT_BL1)
Raef Coles15a37f82021-12-07 15:59:14 +000069 include(${CMAKE_SOURCE_DIR}/bl1/config/bl1_config_default.cmake)
70endif()
71
shejia0184440112021-07-07 10:49:09 +080072# Load MCUboot specific default.cmake
Raef Colesf0ba05b2021-11-25 09:57:17 +000073if (NOT DEFINED BL2 OR BL2)
shejia0184440112021-07-07 10:49:09 +080074 include(${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/mcuboot_default_config.cmake)
75endif()
76
Feder Liangd4dbaa92021-09-07 15:34:46 +080077# Include coprocessor configs
78include(config/cp_config_default.cmake)
79
Ludovic Barre5319ac02021-11-02 09:51:29 +010080# Load defaults, setting options not already set
81include(config/config_default.cmake)
82
David Hu3d2121f2021-08-23 18:00:26 +080083# Fetch tf-m-tests repo during config, if NS or regression test is required.
84# Therefore tf-m-tests configs can be set with TF-M configs since their configs
85# are coupled.
David Hu195cb5a2022-05-10 22:03:26 +080086include(lib/ext/tf-m-tests/fetch_repo.cmake)
David Hu52ff16f2021-08-20 11:39:37 +080087
88# Set secure log configs
89# It also depends on regression test config.
90include(config/tfm_secure_log.cmake)