kconfig: Add new Kconfig for MCUboot swap using move

Adds a new Kconfig for selecting swap using move in MCUboot which
aligns with the proper MCUboot symbol and allows for adding
additional mode Kconfigs

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
Jamie McCrae 2025-01-13 10:47:37 +00:00 committed by Benjamin Cabé
commit 6d35cc5e85
3 changed files with 14 additions and 4 deletions

View file

@ -134,7 +134,7 @@ menu "On board MCUboot operation mode"
choice MCUBOOT_BOOTLOADER_MODE choice MCUBOOT_BOOTLOADER_MODE
prompt "Application assumed MCUboot mode of operation" prompt "Application assumed MCUboot mode of operation"
default MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH # MCUBOOT_BOOTLOADER_MODE default MCUBOOT_BOOTLOADER_MODE_SWAP_USING_MOVE
help help
Informs application build on assumed MCUboot mode of operation. Informs application build on assumed MCUboot mode of operation.
This is important for validataing application against DT configuration, This is important for validataing application against DT configuration,
@ -149,8 +149,8 @@ config MCUBOOT_BOOTLOADER_MODE_SINGLE_APP
to DFU its own update to secondary slot and all updates need to to DFU its own update to secondary slot and all updates need to
be performed using MCUboot serial recovery. be performed using MCUboot serial recovery.
config MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH config MCUBOOT_BOOTLOADER_MODE_SWAP_USING_MOVE
bool "MCUboot has been configured for swap without scratch operation" bool "MCUboot has been configured for swap using move operation"
select MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE select MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE
help help
MCUboot expects slot0_partition and slot1_partition to be present MCUboot expects slot0_partition and slot1_partition to be present
@ -158,6 +158,13 @@ config MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH
MCUBOOT_BOOTLOADER_NO_DOWNGRADE should also be selected MCUBOOT_BOOTLOADER_NO_DOWNGRADE should also be selected
if MCUboot has been built with MCUBOOT_DOWNGRADE_PREVENTION. if MCUboot has been built with MCUBOOT_DOWNGRADE_PREVENTION.
config MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH
bool "MCUboot has been configured for swap without scratch operation [DEPRECATED]"
select DEPRECATED
select MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE
help
This Kconfig is deprecated, use MCUBOOT_BOOTLOADER_MODE_SWAP_USING_MOVE instead.
config MCUBOOT_BOOTLOADER_MODE_SWAP_SCRATCH config MCUBOOT_BOOTLOADER_MODE_SWAP_SCRATCH
bool "MCUboot has been configured for swap using scratch operation" bool "MCUboot has been configured for swap using scratch operation"
select MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE select MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE

View file

@ -568,6 +568,7 @@ int img_mgmt_upload_inspect(const struct img_mgmt_upload_req *req,
const struct flash_area *fa; const struct flash_area *fa;
#if defined(CONFIG_MCUMGR_GRP_IMG_TOO_LARGE_SYSBUILD) && \ #if defined(CONFIG_MCUMGR_GRP_IMG_TOO_LARGE_SYSBUILD) && \
(defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH) || \ (defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH) || \
defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_USING_MOVE) || \
defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_SCRATCH) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_SCRATCH) || \
defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY) || \
defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) || \
@ -644,6 +645,7 @@ int img_mgmt_upload_inspect(const struct img_mgmt_upload_req *req,
#if defined(CONFIG_MCUMGR_GRP_IMG_TOO_LARGE_SYSBUILD) && \ #if defined(CONFIG_MCUMGR_GRP_IMG_TOO_LARGE_SYSBUILD) && \
(defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH) || \ (defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH) || \
defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_USING_MOVE) || \
defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_SCRATCH) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_SCRATCH) || \
defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY) || \
defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) || \

View file

@ -430,7 +430,8 @@ os_mgmt_mcumgr_params(struct smp_streamer *ctxt)
#define BOOTLOADER_MODE MCUBOOT_MODE_SWAP_USING_SCRATCH #define BOOTLOADER_MODE MCUBOOT_MODE_SWAP_USING_SCRATCH
#elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY) #elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY)
#define BOOTLOADER_MODE MCUBOOT_MODE_UPGRADE_ONLY #define BOOTLOADER_MODE MCUBOOT_MODE_UPGRADE_ONLY
#elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH) #elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_USING_MOVE) || \
defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH)
#define BOOTLOADER_MODE MCUBOOT_MODE_SWAP_USING_MOVE #define BOOTLOADER_MODE MCUBOOT_MODE_SWAP_USING_MOVE
#elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) #elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP)
#define BOOTLOADER_MODE MCUBOOT_MODE_DIRECT_XIP #define BOOTLOADER_MODE MCUBOOT_MODE_DIRECT_XIP