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 <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: David Vincze <david.vincze@linaro.org>
This commit is contained in:
David Vincze 2020-06-29 13:34:42 +02:00 committed by Dávid Vincze
parent e574f2d617
commit 5a6e18148d
2 changed files with 26 additions and 3 deletions

View File

@ -164,9 +164,19 @@ config BOOT_VALIDATE_SLOT0
able to modify the flash image itself. able to modify the flash image itself.
if !SINGLE_IMAGE_DFU 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 config BOOT_UPGRADE_ONLY
bool "Overwrite image updates instead of swapping" bool "Overwrite image updates instead of swapping"
default n
help help
If y, overwrite the primary slot with the upgrade image instead If y, overwrite the primary slot with the upgrade image instead
of swapping them. This prevents the fallback recovery, but of swapping them. This prevents the fallback recovery, but
@ -174,8 +184,6 @@ config BOOT_UPGRADE_ONLY
config BOOT_SWAP_USING_MOVE config BOOT_SWAP_USING_MOVE
bool "Swap mode that can run without a scratch partition" bool "Swap mode that can run without a scratch partition"
default y if SOC_FAMILY_NRF
default n
help help
If y, the swap upgrade is done in two steps, where first every 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 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, This allows a swap upgrade without using a scratch partition,
but is currently limited to all sectors in both slots being of but is currently limited to all sectors in both slots being of
the same size. 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 endif
if !SINGLE_IMAGE_DFU if !SINGLE_IMAGE_DFU

View File

@ -66,6 +66,10 @@
#define MCUBOOT_SWAP_USING_MOVE 1 #define MCUBOOT_SWAP_USING_MOVE 1
#endif #endif
#ifdef CONFIG_BOOT_DIRECT_XIP
#define MCUBOOT_DIRECT_XIP
#endif
#ifdef CONFIG_UPDATEABLE_IMAGE_NUMBER #ifdef CONFIG_UPDATEABLE_IMAGE_NUMBER
#define MCUBOOT_IMAGE_NUMBER CONFIG_UPDATEABLE_IMAGE_NUMBER #define MCUBOOT_IMAGE_NUMBER CONFIG_UPDATEABLE_IMAGE_NUMBER
#else #else