Skip to content

Commit 210cdcf

Browse files
Vge0rgenordicjm
authored andcommitted
modules: tf-m: Refactor cmake logic
Refactor the cmake logic for a couple of options in TF-M. This remove the generator expressions for the mcuboot single image option and adds them in an existing if statement as they used to be before the upmerge. Do the same for the hw init nrf peripherals option as well. Signed-off-by: Georgios Vasilakis <[email protected]>
1 parent fd1a0f7 commit 210cdcf

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

modules/trusted-firmware-m/CMakeLists.txt

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,25 @@ if(CONFIG_BOOTLOADER_MCUBOOT AND NOT CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY)
4040

4141
set(mcuboot_single_slot)
4242
mcuboot_single_check(mcuboot_single_slot)
43+
44+
if(${mcuboot_single_slot})
45+
set_property(TARGET zephyr_property_target
46+
APPEND PROPERTY TFM_CMAKE_OPTIONS
47+
-DNRF_NS_SECONDARY=n
48+
)
49+
else()
50+
set_property(TARGET zephyr_property_target
51+
APPEND PROPERTY TFM_CMAKE_OPTIONS
52+
-DNRF_NS_SECONDARY=y
53+
)
54+
endif()
55+
endif()
56+
57+
if(CONFIG_TFM_HW_INIT_RESET_ON_BOOT AND CONFIG_TFM_HW_INIT_NRF_PERIPHERALS)
58+
set_property(TARGET zephyr_property_target
59+
APPEND PROPERTY TFM_CMAKE_OPTIONS
60+
-DNRF_HW_INIT_NRF_PERIPHERALS=ON
61+
)
4362
endif()
4463

4564
set_property(TARGET zephyr_property_target
@@ -60,9 +79,7 @@ set_property(TARGET zephyr_property_target
6079
-DPROJECT_CONFIG_HEADER_FILE=${CMAKE_CURRENT_BINARY_DIR}/tfm_config.h
6180
-DTFM_EXTRA_CONFIG_PATH="${CMAKE_CURRENT_BINARY_DIR}/config_extra.cmake"
6281
-DPS_ROLLBACK_PROTECTION=${CONFIG_TFM_PS_ROLLBACK_PROTECTION}
63-
$<$<AND:$<NOT:$<BOOL:${mcuboot_single_slot}>>,$<BOOL:${CONFIG_BOOTLOADER_MCUBOOT}>>:-DNRF_NS_SECONDARY=ON>
6482
$<$<BOOL:${CONFIG_TFM_HW_INIT_RESET_ON_BOOT}>:-DNRF_HW_INIT_RESET_ON_BOOT=ON>
65-
$<$<BOOL:${CONFIG_TFM_HW_INIT_NRF_PERIPHERALS}>:-DNRF_HW_INIT_NRF_PERIPHERALS=ON>
6683
$<$<BOOL:${CONFIG_TFM_ALLOW_NON_SECURE_RESET}>:-DNRF_ALLOW_NON_SECURE_RESET=ON>
6784
$<$<BOOL:${CONFIG_TFM_SECURE_UART0}>:-DNRF_SECURE_UART_INSTANCE=0>
6885
$<$<BOOL:${CONFIG_TFM_SECURE_UART1}>:-DNRF_SECURE_UART_INSTANCE=1>
@@ -86,7 +103,6 @@ set_property(TARGET zephyr_property_target
86103
$<$<BOOL:${CONFIG_NRF_SECURE_APPROTECT_USER_HANDLING}>:-DCONFIG_NRF_SECURE_APPROTECT_USER_HANDLING=ON>
87104
$<$<BOOL:${CONFIG_IDENTITY_KEY_TFM}>:-DCONFIG_IDENTITY_KEY_TFM=ON>
88105
$<$<BOOL:${CONFIG_TFM_PS_SUPPORT_FORMAT_TRANSITION}>:-DPS_SUPPORT_FORMAT_TRANSITION=ON>
89-
90106
)
91107

92108
if(CONFIG_TFM_PROFILE_TYPE_MINIMAL)

0 commit comments

Comments
 (0)