Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Kevin Peng | 3880066 | 2021-07-14 10:28:23 +0800 | [diff] [blame] | 2 | # Copyright (c) 2020-2021, 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 | |
Tamas Ban | 6921920 | 2020-10-27 08:13:18 +0000 | [diff] [blame] | 28 | # Load platform config, setting options not already set |
Kevin Peng | 3880066 | 2021-07-14 10:28:23 +0800 | [diff] [blame] | 29 | if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/config.cmake) |
Tamas Ban | 6921920 | 2020-10-27 08:13:18 +0000 | [diff] [blame] | 30 | include(platform/ext/target/${TFM_PLATFORM}/config.cmake) |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 31 | endif() |
| 32 | |
Tamas Ban | 6921920 | 2020-10-27 08:13:18 +0000 | [diff] [blame] | 33 | # Load accelerator config, setting options not already set |
| 34 | if (CRYPTO_HW_ACCELERATOR) |
| 35 | if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/accelerator/${CRYPTO_HW_ACCELERATOR_TYPE}/config.cmake) |
| 36 | include(${CMAKE_SOURCE_DIR}/platform/ext/accelerator/${CRYPTO_HW_ACCELERATOR_TYPE}/config.cmake) |
| 37 | endif() |
| 38 | endif() |
| 39 | |
| 40 | # Load profile config, setting options not already set |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 41 | if (TFM_PROFILE) |
Tamas Ban | 6921920 | 2020-10-27 08:13:18 +0000 | [diff] [blame] | 42 | include(config/profile/${TFM_PROFILE}.cmake) |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 43 | endif() |
| 44 | |
David Hu | 9b6a1fe | 2020-12-21 15:16:09 +0800 | [diff] [blame] | 45 | # Load TF-M model specific default config |
| 46 | if (TFM_PSA_API) |
| 47 | include(config/tfm_ipc_config_default.cmake) |
| 48 | endif() |
| 49 | |
Tamas Ban | 6921920 | 2020-10-27 08:13:18 +0000 | [diff] [blame] | 50 | # Load defaults, setting options not already set |
| 51 | include(config/config_default.cmake) |
shejia01 | bfd3712 | 2021-06-03 13:31:51 +0800 | [diff] [blame] | 52 | |
David Hu | 12f2587 | 2021-08-23 14:55:46 +0800 | [diff] [blame] | 53 | # Load TF-M regression test suites setting |
shejia01 | bfd3712 | 2021-06-03 13:31:51 +0800 | [diff] [blame] | 54 | |
David Hu | 12f2587 | 2021-08-23 14:55:46 +0800 | [diff] [blame] | 55 | get_cmake_property(CACHE_VARS CACHE_VARIABLES) |
| 56 | # By default all non-secure regression tests are disabled. |
| 57 | # If TEST_NS or TEST_NS_XXX flag is passed via command line and set to ON, |
| 58 | # selected corresponding features to support non-secure regression tests. |
| 59 | foreach(CACHE_VAR ${CACHE_VARS}) |
| 60 | string(REGEX MATCH "^TEST_NS.*" _NS_TEST_FOUND "${CACHE_VAR}") |
| 61 | if (_NS_TEST_FOUND AND "${${CACHE_VAR}}") |
| 62 | # TFM_NS_REG_TEST is a TF-M internal cmake flag to manage building |
| 63 | # tf-m-tests non-secure regression tests related source |
| 64 | set(TFM_NS_REG_TEST ON) |
| 65 | break() |
| 66 | endif() |
| 67 | endforeach() |
| 68 | |
| 69 | # By default all secure regression tests are disabled. |
| 70 | # If TEST_S or TEST_S_XXX flag is passed via command line and set to ON, |
| 71 | # selected corresponding features to support secure regression tests. |
| 72 | foreach(CACHE_VAR ${CACHE_VARS}) |
| 73 | string(REGEX MATCH "^TEST_S.*" _S_TEST_FOUND "${CACHE_VAR}") |
| 74 | if (_S_TEST_FOUND AND "${${CACHE_VAR}}") |
| 75 | # TFM_S_REG_TEST is a TF-M internal cmake flag to manage building |
| 76 | # tf-m-tests secure regression tests related source |
| 77 | set(TFM_S_REG_TEST ON) |
| 78 | break() |
| 79 | endif() |
| 80 | endforeach() |
| 81 | |
| 82 | if (TFM_NS_REG_TEST OR TFM_S_REG_TEST) |
shejia01 | 50fc684 | 2021-08-20 13:54:30 +0800 | [diff] [blame] | 83 | include(config/tests/set_config.cmake) |
shejia01 | bfd3712 | 2021-06-03 13:31:51 +0800 | [diff] [blame] | 84 | endif() |