Skip to content

Commit 83a3429

Browse files
committed
mgmt: mcumgr: grp: img_mgmt: Add handling for QSPI XIP
Adds handling code to allow selecting the correct image slot when using QSPI XIP in DirectXIP mode In case of Direct XIP and multiple images, the radio active slot changes accordingly (i.e. application slot 1 boots radio slot 1). Moved from sdk-zephyr commit: 0fb761832466933b322fb8030c9ec934b62aa128 Signed-off-by: Jamie McCrae <[email protected]> Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 461682d commit 83a3429

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,15 @@ config MCUMGR_GRP_IMG_NRF
1313
Enables use of an extended version of the image management implementation that adds
1414
Nordic-specific functionalities.
1515

16+
if MCUMGR_GRP_IMG_NRF
17+
18+
config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE
19+
bool "QSPI XIP Split image mode"
20+
depends on MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP
21+
help
22+
This option should not be selected by users and should automatically be selected by
23+
sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP
24+
split image application in DirectXIP mode.
25+
26+
endif # MCUMGR_GRP_IMG_NRF
1627
endmenu

subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,14 @@ int img_mgmt_active_slot(int image)
218218
/* Multi image does not support DirectXIP or RAM load currently */
219219
#if CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER > 1
220220
slot = (image << 1);
221+
222+
#if defined(CONFIG_MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE) || \
223+
defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \
224+
defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT)
225+
if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) {
226+
slot += 1;
227+
}
228+
#endif
221229
#elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD)
222230
/* RAM load requires querying bootloader */
223231
int rc;

0 commit comments

Comments
 (0)