Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Kevin Peng | a2b6802 | 2023-01-13 13:54:05 +0800 | [diff] [blame] | 2 | # Copyright (c) 2020-2023, Arm Limited. All rights reserved. |
Chris Brand | 636ab48 | 2022-05-19 15:55:37 -0700 | [diff] [blame] | 3 | # Copyright (c) 2021-2022 Cypress Semiconductor Corporation (an Infineon company) |
| 4 | # or an affiliate of Cypress Semiconductor Corporation. All rights reserved. |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 5 | # |
| 6 | # SPDX-License-Identifier: BSD-3-Clause |
| 7 | # |
| 8 | #------------------------------------------------------------------------------- |
| 9 | |
| 10 | function(tfm_invalid_config) |
| 11 | if (${ARGV}) |
| 12 | string (REPLACE ";" " " ARGV_STRING "${ARGV}") |
Minos Galanakis | f216e2b | 2020-11-09 17:12:01 +0000 | [diff] [blame] | 13 | string (REPLACE "STREQUAL" "=" ARGV_STRING "${ARGV_STRING}") |
| 14 | string (REPLACE "GREATER" ">" ARGV_STRING "${ARGV_STRING}") |
| 15 | string (REPLACE "LESS" "<" ARGV_STRING "${ARGV_STRING}") |
| 16 | string (REPLACE "VERSION_LESS" "<" ARGV_STRING "${ARGV_STRING}") |
| 17 | string (REPLACE "EQUAL" "=" ARGV_STRING "${ARGV_STRING}") |
| 18 | string (REPLACE "IN_LIST" "in" ARGV_STRING "${ARGV_STRING}") |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 19 | |
| 20 | message(FATAL_ERROR "INVALID CONFIG: ${ARGV_STRING}") |
| 21 | endif() |
| 22 | endfunction() |
| 23 | |
Kevin Peng | 386374c | 2021-11-04 14:36:17 +0800 | [diff] [blame] | 24 | set (VALID_ISOLATION_LEVELS 1 2 3) |
Mingyang Sun | c9d2471 | 2020-10-23 15:06:34 +0800 | [diff] [blame] | 25 | |
Kevin Peng | 386374c | 2021-11-04 14:36:17 +0800 | [diff] [blame] | 26 | tfm_invalid_config(NOT TFM_ISOLATION_LEVEL IN_LIST VALID_ISOLATION_LEVELS) |
Roman Mazurak | ff8e507 | 2022-09-14 00:08:48 +0300 | [diff] [blame] | 27 | tfm_invalid_config(TFM_ISOLATION_LEVEL EQUAL 3 AND NOT PLATFORM_HAS_ISOLATION_L3_SUPPORT) |
Kevin Peng | 386374c | 2021-11-04 14:36:17 +0800 | [diff] [blame] | 28 | tfm_invalid_config(TFM_ISOLATION_LEVEL GREATER 1 AND PSA_FRAMEWORK_HAS_MM_IOVEC) |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 29 | |
Chris Brand | 56b4d0c | 2021-12-17 16:15:58 -0800 | [diff] [blame] | 30 | tfm_invalid_config(TFM_MULTI_CORE_TOPOLOGY AND TFM_NS_MANAGE_NSID) |
Mark Horvath | dadc1ea | 2021-03-12 15:39:25 +0100 | [diff] [blame] | 31 | tfm_invalid_config(TFM_PLAT_SPECIFIC_MULTI_CORE_COMM AND NOT TFM_MULTI_CORE_TOPOLOGY) |
David Hu | 372b45c | 2022-11-16 10:06:28 +0800 | [diff] [blame] | 32 | # Multi-core platform with mailbox partition cannot fully work with SFN backend yet. |
Sherry Zhang | 4851138 | 2023-07-05 11:27:19 +0800 | [diff] [blame] | 33 | tfm_invalid_config(TFM_MULTI_CORE_TOPOLOGY AND (CONFIG_TFM_SPM_BACKEND STREQUAL "SFN")) |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 34 | |
Chris Brand | 30106ba | 2022-01-13 13:48:50 -0800 | [diff] [blame] | 35 | tfm_invalid_config(TFM_ISOLATION_LEVEL EQUAL 3 AND CONFIG_TFM_STACK_WATERMARKS) |
| 36 | |
David Hu | 12f2587 | 2021-08-23 14:55:46 +0800 | [diff] [blame] | 37 | tfm_invalid_config((TFM_S_REG_TEST OR TFM_NS_REG_TEST) AND TEST_PSA_API) |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 38 | |
Øyvind Rønningstad | 7200471 | 2021-03-11 15:55:28 +0100 | [diff] [blame] | 39 | tfm_invalid_config(SUITE STREQUAL "IPC" AND NOT TEST_PSA_API STREQUAL "IPC") |
| 40 | |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 41 | tfm_invalid_config(TEST_PSA_API STREQUAL "CRYPTO" AND NOT TFM_PARTITION_CRYPTO) |
| 42 | tfm_invalid_config(TEST_PSA_API STREQUAL "INITIAL_ATTESTATION" AND NOT TFM_PARTITION_INITIAL_ATTESTATION) |
| 43 | tfm_invalid_config(TEST_PSA_API STREQUAL "INTERNAL_TRUSTED_STORAGE" AND NOT TFM_PARTITION_INTERNAL_TRUSTED_STORAGE) |
| 44 | tfm_invalid_config(TEST_PSA_API STREQUAL "PROTECTED_STORAGE" AND NOT TFM_PARTITION_PROTECTED_STORAGE) |
| 45 | tfm_invalid_config(TEST_PSA_API STREQUAL "STORAGE" AND NOT TFM_PARTITION_INTERNAL_TRUSTED_STORAGE) |
| 46 | tfm_invalid_config(TEST_PSA_API STREQUAL "STORAGE" AND NOT TFM_PARTITION_PROTECTED_STORAGE) |
Summer Qin | dd00194 | 2023-08-24 13:57:12 +0800 | [diff] [blame] | 47 | # PSA Arch crypto test intends to test all PSA crypto APIs. Therefore PSA Arch crypto test |
| 48 | # cannot support to test TF-M Profile Medium, Profile Medium-ARoT-less and Profile Small. |
| 49 | tfm_invalid_config(TEST_PSA_API STREQUAL "CRYPTO" AND TFM_PROFILE STREQUAL "profile_medium") |
| 50 | tfm_invalid_config(TEST_PSA_API STREQUAL "CRYPTO" AND TFM_PROFILE STREQUAL "profile_medium_arotless") |
| 51 | tfm_invalid_config(TEST_PSA_API STREQUAL "CRYPTO" AND TFM_PROFILE STREQUAL "profile_small") |
Raef Coles | 958aeef | 2020-10-08 12:12:58 +0100 | [diff] [blame] | 52 | |
David Vincze | 0c515de | 2020-11-25 19:02:57 +0100 | [diff] [blame] | 53 | ########################## BL2 ################################################# |
| 54 | |
| 55 | get_property(MCUBOOT_STRATEGY_LIST CACHE MCUBOOT_UPGRADE_STRATEGY PROPERTY STRINGS) |
Jianliang Shen | f57c6a7 | 2023-02-20 14:04:38 +0800 | [diff] [blame] | 56 | tfm_invalid_config(BL2 AND (NOT MCUBOOT_UPGRADE_STRATEGY IN_LIST MCUBOOT_STRATEGY_LIST) AND NOT USE_KCONFIG_TOOL) |
David Vincze | 0c515de | 2020-11-25 19:02:57 +0100 | [diff] [blame] | 57 | |
Tintu Thomas | eab1b47 | 2022-03-21 14:27:58 +0000 | [diff] [blame] | 58 | # Maximum number of MCUBoot images supported by TF-M NV counters and ROTPKs |
Arnold Gabriel Benedict | a6242b7 | 2023-02-01 08:34:06 +0000 | [diff] [blame] | 59 | tfm_invalid_config(MCUBOOT_IMAGE_NUMBER GREATER 9) |
Raef Coles | 91fadb9 | 2021-06-18 09:20:50 +0100 | [diff] [blame] | 60 | |
David Vincze | 8c95d2a | 2022-01-19 10:11:58 +0100 | [diff] [blame] | 61 | tfm_invalid_config((BL2 AND CONFIG_TFM_BOOT_STORE_MEASUREMENTS AND NOT CONFIG_TFM_BOOT_STORE_ENCODED_MEASUREMENTS) AND NOT MCUBOOT_DATA_SHARING) |
David Vincze | 8608bdb | 2022-02-11 12:04:54 +0100 | [diff] [blame] | 62 | tfm_invalid_config((NOT (TFM_PARTITION_FIRMWARE_UPDATE OR CONFIG_TFM_BOOT_STORE_MEASUREMENTS)) AND MCUBOOT_DATA_SHARING) |
David Vincze | 8c95d2a | 2022-01-19 10:11:58 +0100 | [diff] [blame] | 63 | |
Michel Jaouen | 24c3dd0 | 2021-08-12 15:32:13 +0200 | [diff] [blame] | 64 | get_property(MCUBOOT_ALIGN_VAL_LIST CACHE MCUBOOT_ALIGN_VAL PROPERTY STRINGS) |
Jianliang Shen | f57c6a7 | 2023-02-20 14:04:38 +0800 | [diff] [blame] | 65 | tfm_invalid_config(BL2 AND (NOT MCUBOOT_ALIGN_VAL IN_LIST MCUBOOT_ALIGN_VAL_LIST) AND NOT USE_KCONFIG_TOOL) |
Michel Jaouen | 24c3dd0 | 2021-08-12 15:32:13 +0200 | [diff] [blame] | 66 | |
Bence Balogh | 4a88384 | 2023-07-06 16:56:46 +0200 | [diff] [blame] | 67 | tfm_invalid_config(TFM_DUMMY_PROVISIONING AND MCUBOOT_GENERATE_SIGNING_KEYPAIR) |
Tamas Ban | 3a7cb3c | 2020-11-25 15:45:04 +0000 | [diff] [blame] | 68 | ####################### Code sharing ########################################### |
| 69 | |
Mark Horvath | c97eb92 | 2022-09-12 11:17:37 +0200 | [diff] [blame] | 70 | set(TFM_CODE_SHARING_PLATFORM_LISTS arm/mps2/an521 arm/musca_b1) # Without crypto hw acceleration |
Tamas Ban | 3a7cb3c | 2020-11-25 15:45:04 +0000 | [diff] [blame] | 71 | tfm_invalid_config(NOT TFM_CODE_SHARING STREQUAL "OFF" AND NOT TFM_PLATFORM IN_LIST TFM_CODE_SHARING_PLATFORM_LISTS) |
| 72 | tfm_invalid_config(NOT TFM_CODE_SHARING STREQUAL "OFF" AND CRYPTO_HW_ACCELERATOR) |
Dávid Házi | 302f81d | 2022-10-17 20:42:44 +0200 | [diff] [blame] | 73 | tfm_invalid_config(NOT TFM_CODE_SHARING STREQUAL "OFF" AND NOT C_COMPILER_ID:IAR) |
Summer Qin | 2cd2ab7 | 2020-04-22 14:55:00 +0800 | [diff] [blame] | 74 | |
Raef Coles | 148b947 | 2021-06-18 08:48:17 +0100 | [diff] [blame] | 75 | ########################## Platform ############################################ |
| 76 | |
| 77 | tfm_invalid_config(OTP_NV_COUNTERS_RAM_EMULATION AND NOT (PLATFORM_DEFAULT_OTP OR PLATFORM_DEFAULT_NV_COUNTERS)) |
Michel Jaouen | d0fd8d9 | 2021-10-14 09:22:41 +0200 | [diff] [blame] | 78 | tfm_invalid_config(PLATFORM_DEFAULT_NV_COUNTERS AND NOT PLATFORM_DEFAULT_OTP_WRITEABLE) |
Sebastian Bøe | 7ad5d85 | 2022-11-03 13:51:21 +0100 | [diff] [blame] | 79 | tfm_invalid_config(TFM_DUMMY_PROVISIONING AND (PLATFORM_DEFAULT_OTP AND NOT PLATFORM_DEFAULT_OTP_WRITEABLE)) |
Raef Coles | 249aba9 | 2022-06-16 10:20:29 +0100 | [diff] [blame] | 80 | tfm_invalid_config(TFM_NS_NV_COUNTER_AMOUNT GREATER 3) |
Raef Coles | 148b947 | 2021-06-18 08:48:17 +0100 | [diff] [blame] | 81 | |
Maulik Patel | f5069ff | 2023-06-05 16:34:43 +0100 | [diff] [blame] | 82 | ####################### Firmware Update Partition ############################### |
Sherry Zhang | 07b4241 | 2021-01-07 14:19:41 +0800 | [diff] [blame] | 83 | |
David Hu | 79bb75c | 2022-08-02 18:04:51 +0800 | [diff] [blame] | 84 | tfm_invalid_config(NOT PLATFORM_HAS_FIRMWARE_UPDATE_SUPPORT AND TFM_PARTITION_FIRMWARE_UPDATE) |
Sherry Zhang | 07b4241 | 2021-01-07 14:19:41 +0800 | [diff] [blame] | 85 | tfm_invalid_config(TFM_PARTITION_FIRMWARE_UPDATE AND NOT TFM_PARTITION_PLATFORM) |
| 86 | tfm_invalid_config((MCUBOOT_UPGRADE_STRATEGY STREQUAL "DIRECT_XIP" OR MCUBOOT_UPGRADE_STRATEGY STREQUAL "RAM_LOAD") AND TFM_PARTITION_FIRMWARE_UPDATE) |
| 87 | tfm_invalid_config(TFM_PARTITION_FIRMWARE_UPDATE AND NOT MCUBOOT_DATA_SHARING) |
Tamas Ban | b881bea | 2020-11-04 16:18:36 +0000 | [diff] [blame] | 88 | |
Maulik Patel | f5069ff | 2023-06-05 16:34:43 +0100 | [diff] [blame] | 89 | ####################### Protected Storage Partition ############################### |
Chris Brand | 636ab48 | 2022-05-19 15:55:37 -0700 | [diff] [blame] | 90 | |
Chris Brand | 9ea9ac7 | 2022-06-27 09:01:21 -0700 | [diff] [blame] | 91 | # PS only uses the platform partition when PS_ROLLBACK_PROTECTION is ON, but |
David Vincze | a6f501e | 2021-06-14 10:42:30 +0200 | [diff] [blame] | 92 | # the dependency in the manifest file means the dependency is unconditional |
Chris Brand | 9ea9ac7 | 2022-06-27 09:01:21 -0700 | [diff] [blame] | 93 | tfm_invalid_config(TFM_PARTITION_PROTECTED_STORAGE AND NOT TFM_PARTITION_PLATFORM) |
Chris Brand | 636ab48 | 2022-05-19 15:55:37 -0700 | [diff] [blame] | 94 | |
Tamas Ban | b881bea | 2020-11-04 16:18:36 +0000 | [diff] [blame] | 95 | ########################## FIH ################################################# |
| 96 | |
| 97 | get_property(TFM_FIH_PROFILE_LIST CACHE TFM_FIH_PROFILE PROPERTY STRINGS) |
| 98 | tfm_invalid_config(NOT TFM_FIH_PROFILE IN_LIST TFM_FIH_PROFILE_LIST) |
David Hu | e056d18 | 2021-03-29 15:14:01 +0800 | [diff] [blame] | 99 | |
Joakim Andersson | 7f572ff | 2022-08-09 16:50:36 +0200 | [diff] [blame] | 100 | ########################### TF-M initial attestation ##################################### |
| 101 | |
| 102 | tfm_invalid_config(ATTEST_INCLUDE_TEST_CODE AND NOT (TEST_NS_ATTESTATION OR TEST_S_ATTESTATION)) |
| 103 | |
Chris Brand | 636ab48 | 2022-05-19 15:55:37 -0700 | [diff] [blame] | 104 | ######################## TF-M Profile config check ############################# |
David Hu | 1feb4b1 | 2022-02-23 17:22:07 +0800 | [diff] [blame] | 105 | |
| 106 | tfm_invalid_config(TFM_PROFILE STREQUAL "profile_small" AND CONFIG_TFM_SPM_BACKEND_IPC) |
| 107 | |
Jianliang Shen | d90aa0c | 2023-03-14 15:02:10 +0800 | [diff] [blame] | 108 | ######################## TF-M Arch config check ################################ |
| 109 | |
| 110 | tfm_invalid_config(TFM_PXN_ENABLE AND NOT TFM_SYSTEM_ARCHITECTURE STREQUAL "armv8.1-m.main") |
| 111 | |
shejia01 | bfd3712 | 2021-06-03 13:31:51 +0800 | [diff] [blame] | 112 | ########################### Test check config ################################## |
| 113 | |
David Hu | 12f2587 | 2021-08-23 14:55:46 +0800 | [diff] [blame] | 114 | if(TFM_S_REG_TEST OR TFM_NS_REG_TEST) |
David Hu | 3d2121f | 2021-08-23 18:00:26 +0800 | [diff] [blame] | 115 | include(${TFM_TEST_PATH}/config/check_config.cmake) |
shejia01 | bfd3712 | 2021-06-03 13:31:51 +0800 | [diff] [blame] | 116 | endif() |
Feder Liang | 5519438 | 2021-11-22 16:45:33 +0800 | [diff] [blame] | 117 | |
| 118 | ###################### Compiler check for FP support ########################### |
| 119 | |
| 120 | include(config/cp_check.cmake) |
Chris Brand | 9edf081 | 2022-07-05 14:18:42 -0700 | [diff] [blame] | 121 | |
| 122 | ###################### Platform-specific checks ################################ |
| 123 | |
Kevin Peng | 174f836 | 2023-04-07 11:32:16 +0800 | [diff] [blame] | 124 | include(${TARGET_PLATFORM_PATH}/check_config.cmake OPTIONAL) |