zephyr: Kconfig: change default for MCUBOOT_CLEANUP_ARM_CODE
Zephyr has introduced an option to perform the cleanup
of ARM core HW registers during early boot, when the
firmware is chain-loaded by MCUboot. Therefore, MCUboot
does not need to perform the same cleanup before jumping
to the application image. The patch relies on the fact
that building MCUboot with Zephyr implies loading also
a Zephyr-based application firmware. If this is not the
case, the application developer needs to enable the
MCUBOOT_CLEANUP_ARM_CODE Kconfig option manually, in the
project configuration.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
diff --git a/boot/zephyr/Kconfig b/boot/zephyr/Kconfig
index 410fc27..3f2374b 100644
--- a/boot/zephyr/Kconfig
+++ b/boot/zephyr/Kconfig
@@ -147,7 +147,20 @@
config MCUBOOT_CLEANUP_ARM_CORE
bool "Perform core cleanup before chain-load the application"
depends on CPU_CORTEX_M
- default y
+ default y if !ARCH_SUPPORTS_ARCH_HW_INIT
+ help
+ This option instructs MCUboot to perform a clean-up of a set of
+ architecture core HW registers before junping to the application
+ firmware. The clean-up sets these registers to their warm-reset
+ values as specified by the architecture.
+
+ By default, this option is enabled only if the architecture does
+ not have the functionality to perform such a register clean-up
+ during application firmware boot.
+
+ Zephyr applications on Cortex-M will perform this register clean-up
+ by default, if they are chain-loadable by MCUboot, so MCUboot does
+ not need to perform such a cleanup itself.
config MBEDTLS_CFG_FILE
default "mcuboot-mbedtls-cfg.h"