blob: da37fe4f96f272aa8df3ff1de95c1ec0ceb0e0fe [file] [log] [blame]
Raef Coles958aeef2020-10-08 12:12:58 +01001#-------------------------------------------------------------------------------
Kevin Peng38800662021-07-14 10:28:23 +08002# Copyright (c) 2020-2021, 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
Tamas Ban69219202020-10-27 08:13:18 +000012# Load extra config
13if (TFM_EXTRA_CONFIG_PATH)
14 include(${TFM_EXTRA_CONFIG_PATH})
15endif()
Raef Coles958aeef2020-10-08 12:12:58 +010016
Jimmy Brisson496d1c42021-06-23 10:33:07 -050017# We usually don't need these messages, and they make it difficult to scan the
18# build log for error and warning messages, so we disable theme here.
19if(NOT TFM_BUILD_LOG_VERBOSE)
20 set(CMAKE_INSTALL_MESSAGE NEVER)
21 set(PARSE_MANIFEST_QUIET ON)
22 set(PARTITION_CONFIG_QUIET ON)
23 set(MEMORY_USAGE_QUIET ON)
24endif()
25
Tamas Ban69219202020-10-27 08:13:18 +000026# Load PSA config, setting options not already set
27if (TEST_PSA_API)
28 include(config/tests/config_test_psa_api.cmake)
29endif()
30
31# Load build type config, setting options not already set
Raef Coles958aeef2020-10-08 12:12:58 +010032string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE)
33if (EXISTS ${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake)
34 include(${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake)
35endif()
36
Tamas Ban69219202020-10-27 08:13:18 +000037# Load platform config, setting options not already set
Kevin Peng38800662021-07-14 10:28:23 +080038if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/config.cmake)
Tamas Ban69219202020-10-27 08:13:18 +000039 include(platform/ext/target/${TFM_PLATFORM}/config.cmake)
Raef Coles958aeef2020-10-08 12:12:58 +010040endif()
41
Tamas Ban69219202020-10-27 08:13:18 +000042# Load accelerator config, setting options not already set
43if (CRYPTO_HW_ACCELERATOR)
44 if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/accelerator/${CRYPTO_HW_ACCELERATOR_TYPE}/config.cmake)
45 include(${CMAKE_SOURCE_DIR}/platform/ext/accelerator/${CRYPTO_HW_ACCELERATOR_TYPE}/config.cmake)
46 endif()
47endif()
48
49# Load profile config, setting options not already set
Raef Coles958aeef2020-10-08 12:12:58 +010050if (TFM_PROFILE)
Tamas Ban69219202020-10-27 08:13:18 +000051 include(config/profile/${TFM_PROFILE}.cmake)
Raef Coles958aeef2020-10-08 12:12:58 +010052endif()
53
David Hu9b6a1fe2020-12-21 15:16:09 +080054# Load TF-M model specific default config
Kevin Peng23a583c2021-09-08 22:33:33 +080055if (TFM_LIB_MODEL)
56 include(config/tfm_library_config_default.cmake)
Kevin Peng76c0c162022-02-09 22:49:06 +080057elseif (CONFIG_TFM_SPM_BACKEND STREQUAL "SFN")
58 include(config/tfm_sfn_config_default.cmake)
59else() #The default backend is IPC
David Hu9b6a1fe2020-12-21 15:16:09 +080060 include(config/tfm_ipc_config_default.cmake)
61endif()
62
shejia0184440112021-07-07 10:49:09 +080063# Load MCUboot specific default.cmake
Raef Colesf0ba05b2021-11-25 09:57:17 +000064if (NOT DEFINED BL2 OR BL2)
shejia0184440112021-07-07 10:49:09 +080065 include(${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/mcuboot_default_config.cmake)
66endif()
67
Feder Liangd4dbaa92021-09-07 15:34:46 +080068# Include coprocessor configs
69include(config/cp_config_default.cmake)
70
Ludovic Barre5319ac02021-11-02 09:51:29 +010071# Load defaults, setting options not already set
72include(config/config_default.cmake)
73
David Hu3d2121f2021-08-23 18:00:26 +080074# Fetch tf-m-tests repo during config, if NS or regression test is required.
75# Therefore tf-m-tests configs can be set with TF-M configs since their configs
76# are coupled.
77include(lib/ext/tf-m-tests/tf-m-tests.cmake)
78
David Hu12f25872021-08-23 14:55:46 +080079# Load TF-M regression test suites setting
David Hu12f25872021-08-23 14:55:46 +080080if (TFM_NS_REG_TEST OR TFM_S_REG_TEST)
David Hu3d2121f2021-08-23 18:00:26 +080081 include(${TFM_TEST_PATH}/config/set_config.cmake)
shejia01bfd37122021-06-03 13:31:51 +080082endif()
David Hu52ff16f2021-08-20 11:39:37 +080083
84# Set secure log configs
85# It also depends on regression test config.
86include(config/tfm_secure_log.cmake)