Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Kevin Peng | c32279d | 2022-02-10 11:11:55 +0800 | [diff] [blame] | 2 | # Copyright (c) 2020-2022, Arm Limited. All rights reserved. |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 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 | |
Tamas Ban | 6921920 | 2020-10-27 08:13:18 +0000 | [diff] [blame] | 12 | # Load extra config |
| 13 | if (TFM_EXTRA_CONFIG_PATH) |
| 14 | include(${TFM_EXTRA_CONFIG_PATH}) |
| 15 | endif() |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 16 | |
Tamas Ban | 6921920 | 2020-10-27 08:13:18 +0000 | [diff] [blame] | 17 | # Load PSA config, setting options not already set |
| 18 | if (TEST_PSA_API) |
| 19 | include(config/tests/config_test_psa_api.cmake) |
| 20 | endif() |
| 21 | |
| 22 | # Load build type config, setting options not already set |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 23 | string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE) |
| 24 | if (EXISTS ${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake) |
| 25 | include(${CMAKE_SOURCE_DIR}/config/build_type/${CMAKE_BUILD_TYPE_LOWERCASE}.cmake) |
| 26 | endif() |
| 27 | |
David Hu | 195cb5a | 2022-05-10 22:03:26 +0800 | [diff] [blame] | 28 | # Parse tf-m-tests config prior to platform specific config.cmake |
| 29 | # Some platforms select different configuration according when regression tests |
| 30 | # are enabled. |
| 31 | include(lib/ext/tf-m-tests/pre_parse.cmake) |
| 32 | |
Tamas Ban | 6921920 | 2020-10-27 08:13:18 +0000 | [diff] [blame] | 33 | # Load platform config, setting options not already set |
Kevin Peng | 3880066 | 2021-07-14 10:28:23 +0800 | [diff] [blame] | 34 | if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/config.cmake) |
Tamas Ban | 6921920 | 2020-10-27 08:13:18 +0000 | [diff] [blame] | 35 | include(platform/ext/target/${TFM_PLATFORM}/config.cmake) |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 36 | endif() |
| 37 | |
Tamas Ban | 6921920 | 2020-10-27 08:13:18 +0000 | [diff] [blame] | 38 | # Load accelerator config, setting options not already set |
| 39 | if (CRYPTO_HW_ACCELERATOR) |
| 40 | if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/accelerator/${CRYPTO_HW_ACCELERATOR_TYPE}/config.cmake) |
| 41 | include(${CMAKE_SOURCE_DIR}/platform/ext/accelerator/${CRYPTO_HW_ACCELERATOR_TYPE}/config.cmake) |
| 42 | endif() |
| 43 | endif() |
| 44 | |
| 45 | # Load profile config, setting options not already set |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 46 | if (TFM_PROFILE) |
Tamas Ban | 6921920 | 2020-10-27 08:13:18 +0000 | [diff] [blame] | 47 | include(config/profile/${TFM_PROFILE}.cmake) |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 48 | endif() |
| 49 | |
Kevin Peng | c32279d | 2022-02-10 11:11:55 +0800 | [diff] [blame] | 50 | include(${CMAKE_SOURCE_DIR}/config/tfm_build_log_config.cmake) |
| 51 | |
David Hu | 9b6a1fe | 2020-12-21 15:16:09 +0800 | [diff] [blame] | 52 | # Load TF-M model specific default config |
Kevin Peng | 23a583c | 2021-09-08 22:33:33 +0800 | [diff] [blame] | 53 | if (TFM_LIB_MODEL) |
| 54 | include(config/tfm_library_config_default.cmake) |
Kevin Peng | 76c0c16 | 2022-02-09 22:49:06 +0800 | [diff] [blame] | 55 | elseif (CONFIG_TFM_SPM_BACKEND STREQUAL "SFN") |
| 56 | include(config/tfm_sfn_config_default.cmake) |
| 57 | else() #The default backend is IPC |
David Hu | 9b6a1fe | 2020-12-21 15:16:09 +0800 | [diff] [blame] | 58 | include(config/tfm_ipc_config_default.cmake) |
| 59 | endif() |
| 60 | |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 61 | # Load bl1 config |
Raef Coles | d32f6bf | 2022-04-19 15:13:00 +0100 | [diff] [blame] | 62 | if (BL1 AND PLATFORM_DEFAULT_BL1) |
Raef Coles | 15a37f8 | 2021-12-07 15:59:14 +0000 | [diff] [blame] | 63 | include(${CMAKE_SOURCE_DIR}/bl1/config/bl1_config_default.cmake) |
| 64 | endif() |
| 65 | |
shejia01 | 8444011 | 2021-07-07 10:49:09 +0800 | [diff] [blame] | 66 | # Load MCUboot specific default.cmake |
Raef Coles | f0ba05b | 2021-11-25 09:57:17 +0000 | [diff] [blame] | 67 | if (NOT DEFINED BL2 OR BL2) |
shejia01 | 8444011 | 2021-07-07 10:49:09 +0800 | [diff] [blame] | 68 | include(${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/mcuboot_default_config.cmake) |
| 69 | endif() |
| 70 | |
Feder Liang | d4dbaa9 | 2021-09-07 15:34:46 +0800 | [diff] [blame] | 71 | # Include coprocessor configs |
| 72 | include(config/cp_config_default.cmake) |
| 73 | |
Ludovic Barre | 5319ac0 | 2021-11-02 09:51:29 +0100 | [diff] [blame] | 74 | # Load defaults, setting options not already set |
| 75 | include(config/config_default.cmake) |
| 76 | |
David Hu | 3d2121f | 2021-08-23 18:00:26 +0800 | [diff] [blame] | 77 | # Fetch tf-m-tests repo during config, if NS or regression test is required. |
| 78 | # Therefore tf-m-tests configs can be set with TF-M configs since their configs |
| 79 | # are coupled. |
David Hu | 195cb5a | 2022-05-10 22:03:26 +0800 | [diff] [blame] | 80 | include(lib/ext/tf-m-tests/fetch_repo.cmake) |
David Hu | 52ff16f | 2021-08-20 11:39:37 +0800 | [diff] [blame] | 81 | |
| 82 | # Set secure log configs |
| 83 | # It also depends on regression test config. |
| 84 | include(config/tfm_secure_log.cmake) |