From 3ccf5d03ff1fb23b664391b855f8bcfa1c19fba5 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Tue, 31 May 2022 12:59:45 +0200 Subject: [PATCH] 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. Signed-off-by: Joakim Andersson --- modules/trusted-firmware-m/CMakeLists.txt | 4 +++- modules/trusted-firmware-m/Kconfig.tfm | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/trusted-firmware-m/CMakeLists.txt b/modules/trusted-firmware-m/CMakeLists.txt index 22214b70bda..e5e5e536dd5 100644 --- a/modules/trusted-firmware-m/CMakeLists.txt +++ b/modules/trusted-firmware-m/CMakeLists.txt @@ -332,7 +332,9 @@ if (CONFIG_BUILD_WITH_TFM) interface/interface.c ) # Non-Secure interface to request system reboot - zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM src/reboot.c) + if (CONFIG_TFM_PARTITION_PLATFORM AND NOT CONFIG_TFM_PARTITION_PLATFORM_CUSTOM_REBOOT) + zephyr_library_sources(src/reboot.c) + endif() zephyr_library_sources_ifndef(CONFIG_TFM_PSA_TEST_NONE src/zephyr_tfm_psa_test.c) zephyr_include_directories( diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index 99224cc3aae..cb7373b9cbe 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -167,6 +167,15 @@ config TFM_ITS_MAX_ASSET_SIZE Maximum size (in bytes) of a single asset to be stored in Internal Trusted Storage (ITS). +config TFM_PARTITION_PLATFORM_CUSTOM_REBOOT + bool "Use custom reboot handler" + depends on TFM_PARTITION_PLATFORM + help + Do not include the default zephyr implementation of calling the TF-M + platform reset service. + Instead the application will have to override the weak ARM + implementation of sys_arch_reset(). + config TFM_BL2_NOT_SUPPORTED bool help