Skip to content

Commit edfaa39

Browse files
oyvindronningstadioannisg
authored andcommitted
tfm: Change TFM_BL2 config from a choice to a bool
The choice allowed for using TFM's own default. We now need full knowledge over whether BL2 is enabled or not (e.g. to do signing), so remove this option and simplify to a bool. Signed-off-by: Øyvind Rønningstad <[email protected]>
1 parent 8f8cdc1 commit edfaa39

File tree

6 files changed

+20
-38
lines changed

6 files changed

+20
-38
lines changed

boards/arm/lpcxpresso55s28/lpcxpresso55s28_ns_defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ CONFIG_ARM_MPU=n
2323
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
2424
CONFIG_RUNTIME_NMI=y
2525
# TFM will run without MCUboot
26-
CONFIG_TFM_BL2_FALSE=y
26+
CONFIG_TFM_BL2=n
2727

2828
CONFIG_BUILD_OUTPUT_HEX=y

boards/arm/lpcxpresso55s69/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if (CONFIG_BUILD_WITH_TFM)
2121
set(TFM_IMAGE_VERSION_NS 0.0.0+0)
2222
endif()
2323

24-
if (NOT CONFIG_TFM_BL2_FALSE)
24+
if (CONFIG_TFM_BL2)
2525
set(PREPROCESSED_FILE_S "${CMAKE_BINARY_DIR}/tfm/bl2/ext/mcuboot/CMakeFiles/signing_layout_s.dir/signing_layout_s.o")
2626
set(PREPROCESSED_FILE_NS "${CMAKE_BINARY_DIR}/tfm/bl2/ext/mcuboot/CMakeFiles/signing_layout_ns.dir/signing_layout_ns.o")
2727
set(TFM_MCUBOOT_DIR "${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/trusted-firmware-m/bl2/ext/mcuboot")
@@ -37,7 +37,7 @@ if (CONFIG_BUILD_WITH_TFM)
3737
message(FATAL_ERROR "'srec_cat' not found. Please install it, or add it to $PATH.")
3838
endif()
3939

40-
if (CONFIG_TFM_BL2_FALSE)
40+
if (NOT CONFIG_TFM_BL2)
4141
#merge tfm_s and zephyr_ns to a single image
4242
#offset needs to be the same value as flash_layout.h in TFM
4343
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands

boards/arm/lpcxpresso55s69/Kconfig.defconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ config FLASH_LOAD_SIZE
5757
if TRUSTED_EXECUTION_NONSECURE || BOARD_LPCXPRESSO55S69_CPU1
5858

5959
config FLASH_LOAD_OFFSET
60-
default 0x40000 if TFM_BL2_FALSE
60+
default 0x40000 if !TFM_BL2
6161
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
6262

6363
config FLASH_LOAD_SIZE
64-
default 0x40000 if TFM_BL2_FALSE
64+
default 0x40000 if !TFM_BL2
6565
default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
6666

6767
endif # TRUSTED_EXECUTION_NONSECURE || BOARD_LPCXPRESSO55S69_CPU1

boards/arm/nrf5340dk_nrf5340/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (CONFIG_BUILD_WITH_TFM)
1717
set(TFM_IMAGE_VERSION_NS 0.0.0+0)
1818
endif()
1919

20-
if (NOT CONFIG_TFM_BL2_FALSE)
20+
if (CONFIG_TFM_BL2)
2121
set(PREPROCESSED_FILE_S "${CMAKE_BINARY_DIR}/tfm/bl2/ext/mcuboot/CMakeFiles/signing_layout_s.dir/signing_layout_s.o")
2222
set(PREPROCESSED_FILE_NS "${CMAKE_BINARY_DIR}/tfm/bl2/ext/mcuboot/CMakeFiles/signing_layout_ns.dir/signing_layout_ns.o")
2323
set(TFM_MCUBOOT_DIR "${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/trusted-firmware-m/bl2/ext/mcuboot")
@@ -39,7 +39,7 @@ if (CONFIG_BUILD_WITH_TFM)
3939
message(FATAL_ERROR "'srec_cat' not found. Please install it, or add it to $PATH.")
4040
endif()
4141

42-
if (CONFIG_TFM_BL2_FALSE)
42+
if (NOT CONFIG_TFM_BL2)
4343
# Merge tfm_s and zephyr (NS) image to a single binary.
4444
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
4545
COMMAND ${SREC_CAT}

modules/trusted-firmware-m/CMakeLists.txt

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ set(TFM_VALID_PARTITIONS
3939
# IPC
4040
# ISOLATION_LEVEL 2
4141
# REGRESSION
42-
# BL2 True
42+
# BL2
4343
# BUILD_PROFILE profile_small
4444
# ENABLED_PARTITIONS TFM_PARTITION_PLATFORM TFM_PARTITION_CRYPTO)
4545
function(trusted_firmware_build)
46-
set(options IPC REGRESSION)
47-
set(oneValueArgs BINARY_DIR BOARD BL2 ISOLATION_LEVEL CMAKE_BUILD_TYPE BUILD_PROFILE
46+
set(options IPC REGRESSION BL2)
47+
set(oneValueArgs BINARY_DIR BOARD ISOLATION_LEVEL CMAKE_BUILD_TYPE BUILD_PROFILE
4848
MCUBOOT_IMAGE_NUMBER)
4949
set(multiValueArgs ENABLED_PARTITIONS)
5050
cmake_parse_arguments(TFM "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@@ -59,11 +59,6 @@ function(trusted_firmware_build)
5959
list(APPEND TFM_PARTITIONS_ARGS -D${partition}=${val})
6060
endforeach()
6161

62-
if(NOT DEFINED TFM_BL2)
63-
set(TFM_BL2 True)
64-
endif()
65-
set(TFM_BL2_ARG "-DBL2=${TFM_BL2}")
66-
6762
if(TFM_IPC)
6863
set(TFM_IPC_ARG -DTFM_PSA_API=ON)
6964
# PSA API awareness for the Non-Secure application
@@ -148,7 +143,7 @@ function(trusted_firmware_build)
148143
-DTFM_PLATFORM=${TFM_BOARD}
149144
-DCROSS_COMPILE=${TFM_TOOLCHAIN_PATH}/${TFM_TOOLCHAIN_PREFIX}
150145
${TFM_CMAKE_BUILD_TYPE_ARG}
151-
${TFM_BL2_ARG}
146+
-DBL2=${TFM_BL2}
152147
${TFM_IPC_ARG}
153148
${TFM_ISOLATION_LEVEL_ARG}
154149
${TFM_REGRESSION_ARG}
@@ -217,10 +212,8 @@ if (CONFIG_BUILD_WITH_TFM)
217212
if (CONFIG_TFM_REGRESSION)
218213
set(TFM_REGRESSION_ARG REGRESSION)
219214
endif()
220-
if (CONFIG_TFM_BL2_TRUE)
221-
set(TFM_BL2_ARG BL2 True)
222-
elseif (CONFIG_TFM_BL2_FALSE)
223-
set(TFM_BL2_ARG BL2 False)
215+
if (CONFIG_TFM_BL2)
216+
set(TFM_BL2_ARG BL2)
224217
endif()
225218
if (CONFIG_TFM_ISOLATION_LEVEL)
226219
set(TFM_ISOLATION_LEVEL_ARG ISOLATION_LEVEL ${CONFIG_TFM_ISOLATION_LEVEL})

modules/trusted-firmware-m/Kconfig

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,12 @@ config TFM_ISOLATION_LEVEL
9898
Manually set the required TFM isolation level. Possible values are
9999
1,2 or 3; the default is set by build configuration.
100100

101-
choice TFM_BL2
102-
prompt "BL2 configuration, should TFM build with MCUboot support"
103-
default TFM_BL2_CONFIG_FILE_DEFAULT
104-
105-
config TFM_BL2_CONFIG_FILE_DEFAULT
106-
bool "Use TFM BL2 setting from TFM configuration file"
101+
config TFM_BL2
102+
bool "Add MCUboot to TFM"
103+
default y
107104
help
108-
This option does not set -DBL2 in TFM, which means the TF-M platform's
109-
default is used. Currently all TF-M platforms have BL2=ON as default.
110-
111-
config TFM_BL2_TRUE
112-
bool "TFM BL2 enabled"
113-
114-
config TFM_BL2_FALSE
115-
bool "TFM BL2 disabled"
116-
117-
endchoice
105+
TFM is designed to run with MCUboot in a certain configuration.
106+
This config adds MCUboot to the build - built via TFM's build system.
118107

119108
config TFM_MCUBOOT_IMAGE_NUMBER
120109
int "Granularity of FW updates of TFM and app"
@@ -205,7 +194,7 @@ config TFM_REGRESSION
205194
the Secure and the Non-Secure regression tests.
206195

207196

208-
if !TFM_BL2_FALSE
197+
if TFM_BL2
209198

210199
config ROM_START_OFFSET
211200
hex "ROM Start Offset accounting for BL2 Header in the NS image"
@@ -215,6 +204,6 @@ config ROM_START_OFFSET
215204
needs to be updated if TF-M switches to use a different header
216205
size for BL2.
217206

218-
endif # !TFM_BL2_FALSE
207+
endif # !TFM_BL2
219208

220209
endif # BUILD_WITH_TFM

0 commit comments

Comments
 (0)