From 5a6e18148d439ae823b53f35c34d51e6df3fdae8 Mon Sep 17 00:00:00 2001 From: David Vincze Date: Mon, 29 Jun 2020 13:34:42 +0200 Subject: [PATCH] zephyr: Add direct-xip mode to Zephyr configuration Add direct-xip mode to Zephyr configuration and make upgrade mode selection always explicit. Change-Id: Ia8e788f0b7bc801b6d45fd86f56c17ca6839f9c9 Co-authored-by: Andrzej Puzdrowski Signed-off-by: David Vincze --- boot/zephyr/Kconfig | 25 ++++++++++++++++--- .../include/mcuboot_config/mcuboot_config.h | 4 +++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/boot/zephyr/Kconfig b/boot/zephyr/Kconfig index f1ec0a72..2e416b84 100644 --- a/boot/zephyr/Kconfig +++ b/boot/zephyr/Kconfig @@ -164,9 +164,19 @@ config BOOT_VALIDATE_SLOT0 able to modify the flash image itself. if !SINGLE_IMAGE_DFU +choice + prompt "Image upgrade modes" + default BOOT_SWAP_USING_MOVE if SOC_FAMILY_NRF + default BOOT_SWAP_USING_SCRATCH + +config BOOT_SWAP_USING_SCRATCH + bool "Swap mode that run with the scratch partition" + help + This is the most conservative swap mode but it can work even on + devices with heterogeneous flash page layout. + config BOOT_UPGRADE_ONLY bool "Overwrite image updates instead of swapping" - default n help If y, overwrite the primary slot with the upgrade image instead of swapping them. This prevents the fallback recovery, but @@ -174,8 +184,6 @@ config BOOT_UPGRADE_ONLY config BOOT_SWAP_USING_MOVE bool "Swap mode that can run without a scratch partition" - default y if SOC_FAMILY_NRF - default n help If y, the swap upgrade is done in two steps, where first every sector of the primary slot is moved up one sector, then for @@ -185,6 +193,17 @@ config BOOT_SWAP_USING_MOVE This allows a swap upgrade without using a scratch partition, but is currently limited to all sectors in both slots being of the same size. + +config BOOT_DIRECT_XIP + bool "Run the latest image directly from its slot" + help + If y, mcuboot selects the newest valid image based on the image version + numbers, thereafter the selected image can run directly from its slot + without having to move/copy it into the primary slot. For this reason the + images must be linked to be executed from the given image slot. Using this + mode results in a simpler code path and smaller code size. + +endchoice endif if !SINGLE_IMAGE_DFU diff --git a/boot/zephyr/include/mcuboot_config/mcuboot_config.h b/boot/zephyr/include/mcuboot_config/mcuboot_config.h index 044ec3d5..530e8dc3 100644 --- a/boot/zephyr/include/mcuboot_config/mcuboot_config.h +++ b/boot/zephyr/include/mcuboot_config/mcuboot_config.h @@ -66,6 +66,10 @@ #define MCUBOOT_SWAP_USING_MOVE 1 #endif +#ifdef CONFIG_BOOT_DIRECT_XIP +#define MCUBOOT_DIRECT_XIP +#endif + #ifdef CONFIG_UPDATEABLE_IMAGE_NUMBER #define MCUBOOT_IMAGE_NUMBER CONFIG_UPDATEABLE_IMAGE_NUMBER #else