From e1b4677d96d37660ad3ef35fe1700824bd47dc1a Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 18 Jul 2025 07:44:37 +0100 Subject: [PATCH 1/2] boot: zephyr: Set prefer swap using move for aligned boards To prevent breakage when the default mode changes to swap using offset, any board that is current set up to have more sectors in slot0 has been excluded from the move Signed-off-by: Jamie McCrae --- boot/zephyr/boards/ctcc_nrf52840.conf | 3 +++ boot/zephyr/boards/decawave_dwm3001cdk.conf | 2 ++ boot/zephyr/boards/it8xxx2_evb.conf | 2 ++ boot/zephyr/boards/micromod_nrf52840..conf | 2 ++ boot/zephyr/boards/myra_sip_baseboard.conf | 2 ++ boot/zephyr/boards/numaker_pfm_m467.conf | 2 ++ 6 files changed, 13 insertions(+) create mode 100644 boot/zephyr/boards/decawave_dwm3001cdk.conf create mode 100644 boot/zephyr/boards/it8xxx2_evb.conf create mode 100644 boot/zephyr/boards/micromod_nrf52840..conf create mode 100644 boot/zephyr/boards/myra_sip_baseboard.conf create mode 100644 boot/zephyr/boards/numaker_pfm_m467.conf diff --git a/boot/zephyr/boards/ctcc_nrf52840.conf b/boot/zephyr/boards/ctcc_nrf52840.conf index ec8ea7f9f3..5cbe290f64 100644 --- a/boot/zephyr/boards/ctcc_nrf52840.conf +++ b/boot/zephyr/boards/ctcc_nrf52840.conf @@ -18,3 +18,6 @@ CONFIG_MULTITHREADING=y # USB CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_REMOTE_WAKEUP=n + +# Partitions set up for swap using move +CONFIG_BOOT_PREFER_SWAP_MOVE=y diff --git a/boot/zephyr/boards/decawave_dwm3001cdk.conf b/boot/zephyr/boards/decawave_dwm3001cdk.conf new file mode 100644 index 0000000000..13013eaebe --- /dev/null +++ b/boot/zephyr/boards/decawave_dwm3001cdk.conf @@ -0,0 +1,2 @@ +# Partitions set up for swap using move +CONFIG_BOOT_PREFER_SWAP_MOVE=y diff --git a/boot/zephyr/boards/it8xxx2_evb.conf b/boot/zephyr/boards/it8xxx2_evb.conf new file mode 100644 index 0000000000..13013eaebe --- /dev/null +++ b/boot/zephyr/boards/it8xxx2_evb.conf @@ -0,0 +1,2 @@ +# Partitions set up for swap using move +CONFIG_BOOT_PREFER_SWAP_MOVE=y diff --git a/boot/zephyr/boards/micromod_nrf52840..conf b/boot/zephyr/boards/micromod_nrf52840..conf new file mode 100644 index 0000000000..13013eaebe --- /dev/null +++ b/boot/zephyr/boards/micromod_nrf52840..conf @@ -0,0 +1,2 @@ +# Partitions set up for swap using move +CONFIG_BOOT_PREFER_SWAP_MOVE=y diff --git a/boot/zephyr/boards/myra_sip_baseboard.conf b/boot/zephyr/boards/myra_sip_baseboard.conf new file mode 100644 index 0000000000..13013eaebe --- /dev/null +++ b/boot/zephyr/boards/myra_sip_baseboard.conf @@ -0,0 +1,2 @@ +# Partitions set up for swap using move +CONFIG_BOOT_PREFER_SWAP_MOVE=y diff --git a/boot/zephyr/boards/numaker_pfm_m467.conf b/boot/zephyr/boards/numaker_pfm_m467.conf new file mode 100644 index 0000000000..13013eaebe --- /dev/null +++ b/boot/zephyr/boards/numaker_pfm_m467.conf @@ -0,0 +1,2 @@ +# Partitions set up for swap using move +CONFIG_BOOT_PREFER_SWAP_MOVE=y From ed957d4e559ec2cb2ab2b6cc1030d67657a4c14c Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 17 Apr 2025 08:52:43 +0100 Subject: [PATCH 2/2] boot: zephyr: kconfig: Default to swap using offset Defaults to the new swap using offset mode, excluding stm32 as these devices are already aligned to swap using move with extra sectors in slot0 Signed-off-by: Jamie McCrae --- boot/zephyr/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/boot/zephyr/Kconfig b/boot/zephyr/Kconfig index 3285416be7..ec86ea0534 100644 --- a/boot/zephyr/Kconfig +++ b/boot/zephyr/Kconfig @@ -408,6 +408,7 @@ config BOOT_VALIDATE_SLOT0_ONCE config BOOT_PREFER_SWAP_OFFSET bool "Prefer the newer swap offset algorithm" + default y if !$(dt_nodelabel_enabled,scratch_partition) && !SOC_FAMILY_STM32 help If y, the BOOT_IMAGE_UPGRADE_MODE will default to using "offset" instead of "scratch". This is a separate bool config option, because Kconfig doesn't allow defaults to be @@ -415,7 +416,7 @@ config BOOT_PREFER_SWAP_OFFSET config BOOT_PREFER_SWAP_MOVE bool "Prefer the newer swap move algorithm" - default y if SOC_FAMILY_NORDIC_NRF + depends on !BOOT_PREFER_SWAP_OFFSET default y if !$(dt_nodelabel_enabled,scratch_partition) help If y, the BOOT_IMAGE_UPGRADE_MODE will default to using