Skip to content

Commit 0a904d0

Browse files
joerchancarlescufi
authored andcommitted
[nrf fromlist] tfm: Add option for implementation custom reset handler with TF-M
Zephyr adds a custom handler that overrides the weak function sys_arch_reset when TF-M platform partition is enabled. This takes away the option for the application to override the weak definition for their platform or use-case. Add an option that control whether this default reset handling is added to the build. Upstream PR: zephyrproject-rtos/zephyr#46133 Signed-off-by: Joakim Andersson <[email protected]>
1 parent 5b202e4 commit 0a904d0

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

modules/trusted-firmware-m/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ if (CONFIG_BUILD_WITH_TFM)
324324
interface/interface.c
325325
)
326326
# Non-Secure interface to request system reboot
327-
zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM src/reboot.c)
327+
if (CONFIG_TFM_PARTITION_PLATFORM AND NOT CONFIG_TFM_PARTITION_PLATFORM_CUSTOM_REBOOT)
328+
zephyr_library_sources(src/reboot.c)
329+
endif()
328330
zephyr_library_sources_ifndef(CONFIG_TFM_PSA_TEST_NONE src/zephyr_tfm_psa_test.c)
329331

330332
zephyr_include_directories(

modules/trusted-firmware-m/Kconfig.tfm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ config TFM_ITS_MAX_ASSET_SIZE
167167
Maximum size (in bytes) of a single asset to be stored in Internal Trusted
168168
Storage (ITS).
169169

170+
config TFM_PARTITION_PLATFORM_CUSTOM_REBOOT
171+
bool "Use custom reboot handler"
172+
depends on TFM_PARTITION_PLATFORM
173+
help
174+
Do not include the default zephyr implementation of calling the TF-M
175+
platform reset service.
176+
Instead the application will have to override the weak ARM
177+
implementation of sys_arch_reset().
178+
170179
config TFM_BL2_NOT_SUPPORTED
171180
bool
172181
help

0 commit comments

Comments
 (0)