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