blob: add24142fa74027792e560ce3047ae8155bd62ba [file] [log] [blame]
Raef Coles9ec67e62020-07-10 09:40:35 +01001#-------------------------------------------------------------------------------
Raef Colesdfe519b2021-01-07 12:52:47 +00002# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
Raef Coles9ec67e62020-07-10 09:40:35 +01003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
Raef Coles69817322020-10-19 14:14:14 +01008set(TFM_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/toolchain_GNUARM.cmake CACHE FILEPATH "Path to TFM compiler toolchain file")
Øyvind Rønningstada9d5eac2021-01-22 14:21:25 +01009set(TFM_PLATFORM "" CACHE STRING "Platform to build TF-M for. Must be either a relative path from [TF-M]/platform/ext/target, or an absolute path.")
Raef Coles69817322020-10-19 14:14:14 +010010set(CROSS_COMPILE arm-none-eabi CACHE STRING "Cross-compilation triplet")
11
Raef Coles9ec67e62020-07-10 09:40:35 +010012set(BL2 ON CACHE BOOL "Whether to build BL2")
13set(NS ON CACHE BOOL "Whether to build NS app")
14
15set(TEST_S OFF CACHE BOOL "Whether to build S regression tests")
16set(TEST_NS OFF CACHE BOOL "Whether to build NS regression tests")
17set(TEST_PSA_API "" CACHE STRING "Which (if any) of the PSA API tests should be compiled")
18
Kevin Peng23a583c2021-09-08 22:33:33 +080019# TFM_LIB_MODEL is the only user configuration for Library Model selection.
20# TFM_PSA_API becomes an internal variable. Please do NOT use it in build command line.
21set(TFM_LIB_MODEL OFF CACHE BOOL "Use secure library model instead of PSA API (IPC model)")
Raef Coles9ec67e62020-07-10 09:40:35 +010022set(TFM_ISOLATION_LEVEL 1 CACHE STRING "Isolation level")
23set(TFM_PROFILE "" CACHE STRING "Profile to use")
Tamas Banb881bea2020-11-04 16:18:36 +000024set(TFM_FIH_PROFILE OFF CACHE STRING "Fault injection hardening profile [OFF, LOW, MEDIUM, HIGH]")
Raef Coles9ec67e62020-07-10 09:40:35 +010025
26set(TFM_NS_CLIENT_IDENTIFICATION OFF CACHE BOOL "Enable NS client identification")
27
28set(TFM_EXTRA_CONFIG_PATH "" CACHE PATH "Path to extra cmake config file")
Kevin Peng38800662021-07-14 10:28:23 +080029
30set(TFM_MANIFEST_LIST ${CMAKE_SOURCE_DIR}/tools/tfm_manifest_list.yaml CACHE FILEPATH "TF-M native Secure Partition manifests list file")
David Hub2694202021-07-15 14:58:39 +080031set(TFM_EXTRA_MANIFEST_LIST_FILES "" CACHE FILEPATH "Extra manifest list file(s), used to list extra Secure Partition manifests.")
Raef Coles9ec67e62020-07-10 09:40:35 +010032set(TFM_EXTRA_GENERATED_FILE_LIST_PATH "" CACHE PATH "Path to extra generated file list. Appended to stardard TFM generated file list.")
David Hub2694202021-07-15 14:58:39 +080033set(TFM_EXTRA_PARTITION_PATHS "" CACHE PATH "List of extra Secure Partitions directories. An extra Secure Parition folder contains source code, CMakeLists.txt and manifest files")
Raef Coles9ec67e62020-07-10 09:40:35 +010034
Shawn Shanfffd7ee2020-11-23 18:07:54 +080035set(TFM_SPM_LOG_LEVEL TFM_SPM_LOG_LEVEL_INFO CACHE STRING "Set default SPM log level as INFO level")
Shawn Shan9ea2f802020-11-19 11:04:39 +080036set(TFM_PARTITION_LOG_LEVEL TFM_PARTITION_LOG_LEVEL_INFO CACHE STRING "Set default Secure Partition log level as INFO level")
Shawn Shan6f33aad2020-10-16 15:30:17 +080037
Tamas Banf8b0b2d2020-10-26 13:03:13 +000038set(TFM_CODE_SHARING OFF CACHE PATH "Enable code sharing between MCUboot and secure firmware")
39set(TFM_CODE_SHARING_PATH "" CACHE PATH "Path to repo which shares code with secure firmware")
40
Raef Colesa198a442020-11-24 11:42:53 +000041set(TFM_INSTALL_PATH ${CMAKE_BINARY_DIR}/install CACHE PATH "Path to which to install TF-M files")
42
Karl Zhangf897e9e2021-01-08 17:52:53 +080043set(TFM_CODE_COVERAGE OFF CACHE BOOL "Whether to build the binary for lcov tools by adding -g")
44
Summer Qin2cd2ab72020-04-22 14:55:00 +080045set(TFM_SP_META_PTR_ENABLE OFF CACHE BOOL "Use Partition Metadata Pointer")
46
Summer Qind8395932021-02-25 14:56:49 +080047set(TFM_PXN_ENABLE OFF CACHE BOOL "Use Privileged execute never (PXN)")
48
Øyvind Rønningstadf2c8dad2021-01-15 15:33:33 +010049set(TFM_EXCEPTION_INFO_DUMP OFF CACHE BOOL "On fatal errors in the secure firmware, capture info about the exception. Print the info if the SPM log level is sufficient.")
50
Raef Coles9ec67e62020-07-10 09:40:35 +010051############################ Platform ##########################################
52
53set(TFM_MULTI_CORE_TOPOLOGY OFF CACHE BOOL "Whether to build for a dual-cpu architecture")
David Hu8b526d42020-11-27 20:59:52 +080054set(NUM_MAILBOX_QUEUE_SLOT 1 CACHE BOOL "Number of mailbox queue slots")
Mark Horvathdadc1ea2021-03-12 15:39:25 +010055set(TFM_PLAT_SPECIFIC_MULTI_CORE_COMM OFF CACHE BOOL "Whether to use a platform specific inter-core communication instead of mailbox in dual-cpu topology")
David Hu60863942020-10-14 14:49:19 +080056
Raef Coles9ec67e62020-07-10 09:40:35 +010057set(DEBUG_AUTHENTICATION CHIP_DEFAULT CACHE STRING "Debug authentication setting. [CHIP_DEFAULT, NONE, NS_ONLY, FULL")
58set(SECURE_UART1 OFF CACHE BOOL "Enable secure UART1")
59
60set(CRYPTO_HW_ACCELERATOR OFF CACHE BOOL "Whether to enable the crypto hardware accelerator on supported platforms")
61set(CRYPTO_HW_ACCELERATOR_OTP_STATE OFF CACHE STRING "Whether to enable the crypto hardware accelerator OTP memory on supported platforms (Set to PROVISIONING to enable OTP provisioning)")
62
Raef Coles148b9472021-06-18 08:48:17 +010063set(OTP_NV_COUNTERS_RAM_EMULATION OFF CACHE BOOL "Enable OTP/NV_COUNTERS emulation in RAM. Has no effect on non-default implementations of the OTP and NV_COUNTERS")
64
Raef Coles9ec67e62020-07-10 09:40:35 +010065set(PLATFORM_DUMMY_ATTEST_HAL TRUE CACHE BOOL "Use dummy attest hal implementation. Should not be used in production.")
66set(PLATFORM_DUMMY_NV_COUNTERS TRUE CACHE BOOL "Use dummy nv counter implementation. Should not be used in production.")
67set(PLATFORM_DUMMY_CRYPTO_KEYS TRUE CACHE BOOL "Use dummy crypto keys. Should not be used in production.")
68set(PLATFORM_DUMMY_ROTPK TRUE CACHE BOOL "Use dummy root of trust public key. Dummy key is the public key for the default keys in bl2. Should not be used in production.")
69set(PLATFORM_DUMMY_IAK TRUE CACHE BOOL "Use dummy initial attestation_key. Should not be used in production.")
Gabor Abonyi931622b2020-10-19 15:08:40 +020070set(PLATFORM_DEFAULT_UART_STDOUT TRUE CACHE BOOL "Use default uart stdout implementation.")
Summer Qin9347dc72021-07-12 18:57:57 +080071set(PLATFORM_DUMMY_NV_SEED TRUE CACHE BOOL "Use dummy NV seed implementation. Should not be used in production.")
Raef Coles148b9472021-06-18 08:48:17 +010072set(PLATFORM_DEFAULT_OTP ON CACHE BOOL "Use trusted on-chip flash to implement OTP memory")
Raef Coles9ec67e62020-07-10 09:40:35 +010073
74############################ Partitions ########################################
75
76set(TFM_PARTITION_PROTECTED_STORAGE ON CACHE BOOL "Enable Protected Storage partition")
Jamie Fox865778b2020-10-23 19:52:51 +010077set(PS_CREATE_FLASH_LAYOUT ON CACHE BOOL "Create flash FS if it doesn't exist for Protected Storage partition")
Raef Coles9ec67e62020-07-10 09:40:35 +010078set(PS_ENCRYPTION ON CACHE BOOL "Enable encryption for Protected Storage partition")
79set(PS_RAM_FS OFF CACHE BOOL "Enable emulated RAM FS for platforms that don't have flash for Protected Storage partition")
80set(PS_ROLLBACK_PROTECTION ON CACHE BOOL "Enable rollback protection for Protected Storage partition")
Jamie Fox34a7a232020-10-20 16:19:09 +010081set(PS_VALIDATE_METADATA_FROM_FLASH ON CACHE BOOL "Validate filesystem metadata every time it is read from flash")
Jamie Fox865778b2020-10-23 19:52:51 +010082set(PS_MAX_ASSET_SIZE "2048" CACHE STRING "The maximum asset size to be stored in the Protected Storage area")
83set(PS_NUM_ASSETS "10" CACHE STRING "The maximum number of assets to be stored in the Protected Storage area")
84set(PS_CRYPTO_AEAD_ALG PSA_ALG_GCM CACHE STRING "The AEAD algorithm to use for authenticated encryption in Protected Storage")
Raef Coles9ec67e62020-07-10 09:40:35 +010085
86set(TFM_PARTITION_INTERNAL_TRUSTED_STORAGE ON CACHE BOOL "Enable Internal Trusted Storage partition")
Jamie Fox865778b2020-10-23 19:52:51 +010087set(ITS_CREATE_FLASH_LAYOUT ON CACHE BOOL "Create flash FS if it doesn't exist for Internal Trusted Storage partition")
88set(ITS_RAM_FS OFF CACHE BOOL "Enable emulated RAM FS for platforms that don't have flash for Internal Trusted Storage partition")
Jamie Fox34a7a232020-10-20 16:19:09 +010089set(ITS_VALIDATE_METADATA_FROM_FLASH ON CACHE BOOL "Validate filesystem metadata every time it is read from flash")
Jamie Fox865778b2020-10-23 19:52:51 +010090set(ITS_MAX_ASSET_SIZE "512" CACHE STRING "The maximum asset size to be stored in the Internal Trusted Storage area")
91set(ITS_NUM_ASSETS "10" CACHE STRING "The maximum number of assets to be stored in the Internal Trusted Storage area")
Raef Coles9ec67e62020-07-10 09:40:35 +010092set(ITS_BUF_SIZE "" CACHE STRING "Size of the ITS internal data transfer buffer (defaults to ITS_MAX_ASSET_SIZE if not set)")
93
94set(TFM_PARTITION_CRYPTO ON CACHE BOOL "Enable Crypto partition")
Soby Mathew4739c732020-10-07 12:11:05 +010095# CRYPTO_ENGINE_BUF_SIZE needs to be >8KB for EC signing by attest module.
Summer Qine8412b42020-10-15 14:20:21 +080096set(CRYPTO_ENGINE_BUF_SIZE 0x2080 CACHE STRING "Heap size for the crypto backend")
Soby Mathew4739c732020-10-07 12:11:05 +010097set(CRYPTO_CONC_OPER_NUM 8 CACHE STRING "The max number of concurrent operations that can be active (allocated) at any time in Crypto")
Ioannis Glaropoulos829aa752021-06-15 12:37:02 +020098set(CRYPTO_RNG_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto random number generator module")
Soby Mathew4739c732020-10-07 12:11:05 +010099set(CRYPTO_KEY_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto Key module")
100set(CRYPTO_AEAD_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto AEAD module")
101set(CRYPTO_MAC_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto MAC module")
102set(CRYPTO_HASH_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto Hash module")
103set(CRYPTO_CIPHER_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto Cipher module")
David Hu0c250bc2021-05-12 10:55:53 +0800104set(CRYPTO_ASYM_SIGN_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto asymmetric key signature module")
105set(CRYPTO_ASYM_ENCRYPT_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto asymmetric key encryption module")
Håkon Øye Amundsen112e48d2021-01-19 15:41:10 +0100106set(CRYPTO_KEY_DERIVATION_MODULE_DISABLED FALSE CACHE BOOL "Disable PSA Crypto key derivation module")
Soby Mathew4739c732020-10-07 12:11:05 +0100107set(CRYPTO_IOVEC_BUFFER_SIZE 5120 CACHE STRING "Default size of the internal scratch buffer used for PSA FF IOVec allocations")
Raef Coles9ec67e62020-07-10 09:40:35 +0100108
109set(TFM_PARTITION_INITIAL_ATTESTATION ON CACHE BOOL "Enable Initial Attestation partition")
110set(SYMMETRIC_INITIAL_ATTESTATION OFF CACHE BOOL "Use symmetric crypto for inital attestation")
111set(ATTEST_INCLUDE_OPTIONAL_CLAIMS ON CACHE BOOL "Include optional claims in initial attestation token")
112set(ATTEST_INCLUDE_COSE_KEY_ID OFF CACHE BOOL "Include COSE key-id in initial attestation token")
113
114set(TFM_PARTITION_PLATFORM ON CACHE BOOL "Enable Platform partition")
115
Kevin Peng23a583c2021-09-08 22:33:33 +0800116set(TFM_PARTITION_AUDIT_LOG OFF CACHE BOOL "Enable Audit Log partition")
Raef Coles9ec67e62020-07-10 09:40:35 +0100117
Mark Horvathb9ac0d52020-09-09 10:48:22 +0200118set(FORWARD_PROT_MSG OFF CACHE BOOL "Whether to forward all PSA RoT messages to a Secure Enclave")
Sherry Zhang07b42412021-01-07 14:19:41 +0800119set(TFM_PARTITION_FIRMWARE_UPDATE OFF CACHE BOOL "Enable firmware update partition")
Sherry Zhang539ade42021-05-19 15:14:27 +0800120set(TFM_FWU_BOOTLOADER_LIB "mcuboot" CACHE STRING "Bootloader configure file for Firmware Update partition")
Mark Horvathb9ac0d52020-09-09 10:48:22 +0200121
Raef Coles9ec67e62020-07-10 09:40:35 +0100122################################## Dependencies ################################
123
124set(MBEDCRYPTO_PATH "DOWNLOAD" CACHE PATH "Path to Mbed Crypto (or DOWNLOAD to fetch automatically")
Summer Qin359167d2021-07-05 18:11:50 +0800125set(MBEDCRYPTO_VERSION "mbedtls-3.0.0" CACHE STRING "The version of Mbed Crypto to use")
Øyvind Rønningstad6d3f3df2021-02-10 18:25:56 +0100126set(MBEDCRYPTO_GIT_REMOTE "https://github.com/ARMmbed/mbedtls.git" CACHE STRING "The URL (or path) to retrieve MbedTLS from.")
Raef Coles9ec67e62020-07-10 09:40:35 +0100127set(MBEDCRYPTO_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Build type of Mbed Crypto library")
128set(TFM_MBEDCRYPTO_CONFIG_PATH "${CMAKE_SOURCE_DIR}/lib/ext/mbedcrypto/mbedcrypto_config/tfm_mbedcrypto_config_default.h" CACHE PATH "Config to use for Mbed Crypto")
129set(TFM_MBEDCRYPTO_PLATFORM_EXTRA_CONFIG_PATH "" CACHE PATH "Config to append to standard Mbed Crypto config, used by platforms to cnfigure feature support")
130
David Vincze7e1c5a42021-07-28 23:41:35 +0200131set(MCUBOOT_PATH "DOWNLOAD" CACHE PATH "Path to MCUboot (or DOWNLOAD to fetch automatically")
132set(MCUBOOT_VERSION "TF-Mv1.4-integ" CACHE STRING "The version of MCUboot to use")
Raef Coles9ec67e62020-07-10 09:40:35 +0100133
134set(PSA_ARCH_TESTS_PATH "DOWNLOAD" CACHE PATH "Path to PSA arch tests (or DOWNLOAD to fetch automatically")
Kevin Pengd5456c52021-09-22 10:37:09 +0800135set(PSA_ARCH_TESTS_VERSION "51ff2bd" CACHE STRING "The version of PSA arch tests to use")
David Vincze0c515de2020-11-25 19:02:57 +0100136
137################################################################################
138################################################################################
139
140# Specifying the accepted values for certain configuration options to facilitate
141# their later validation.
142
Tamas Banb881bea2020-11-04 16:18:36 +0000143########################## FIH #################################################
144
145set_property(CACHE TFM_FIH_PROFILE PROPERTY STRINGS "OFF;LOW;MEDIUM;HIGH")