Skip to content

Commit 5a6e181

Browse files
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 <[email protected]> Signed-off-by: David Vincze <[email protected]>
1 parent e574f2d commit 5a6e181

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

boot/zephyr/Kconfig

+22-3
Original file line numberDiff line numberDiff line change
@@ -164,18 +164,26 @@ config BOOT_VALIDATE_SLOT0
164164
able to modify the flash image itself.
165165

166166
if !SINGLE_IMAGE_DFU
167+
choice
168+
prompt "Image upgrade modes"
169+
default BOOT_SWAP_USING_MOVE if SOC_FAMILY_NRF
170+
default BOOT_SWAP_USING_SCRATCH
171+
172+
config BOOT_SWAP_USING_SCRATCH
173+
bool "Swap mode that run with the scratch partition"
174+
help
175+
This is the most conservative swap mode but it can work even on
176+
devices with heterogeneous flash page layout.
177+
167178
config BOOT_UPGRADE_ONLY
168179
bool "Overwrite image updates instead of swapping"
169-
default n
170180
help
171181
If y, overwrite the primary slot with the upgrade image instead
172182
of swapping them. This prevents the fallback recovery, but
173183
uses a much simpler code path.
174184

175185
config BOOT_SWAP_USING_MOVE
176186
bool "Swap mode that can run without a scratch partition"
177-
default y if SOC_FAMILY_NRF
178-
default n
179187
help
180188
If y, the swap upgrade is done in two steps, where first every
181189
sector of the primary slot is moved up one sector, then for
@@ -185,6 +193,17 @@ config BOOT_SWAP_USING_MOVE
185193
This allows a swap upgrade without using a scratch partition,
186194
but is currently limited to all sectors in both slots being of
187195
the same size.
196+
197+
config BOOT_DIRECT_XIP
198+
bool "Run the latest image directly from its slot"
199+
help
200+
If y, mcuboot selects the newest valid image based on the image version
201+
numbers, thereafter the selected image can run directly from its slot
202+
without having to move/copy it into the primary slot. For this reason the
203+
images must be linked to be executed from the given image slot. Using this
204+
mode results in a simpler code path and smaller code size.
205+
206+
endchoice
188207
endif
189208

190209
if !SINGLE_IMAGE_DFU

boot/zephyr/include/mcuboot_config/mcuboot_config.h

+4
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@
6666
#define MCUBOOT_SWAP_USING_MOVE 1
6767
#endif
6868

69+
#ifdef CONFIG_BOOT_DIRECT_XIP
70+
#define MCUBOOT_DIRECT_XIP
71+
#endif
72+
6973
#ifdef CONFIG_UPDATEABLE_IMAGE_NUMBER
7074
#define MCUBOOT_IMAGE_NUMBER CONFIG_UPDATEABLE_IMAGE_NUMBER
7175
#else

0 commit comments

Comments
 (0)