Skip to content

Commit f56418e

Browse files
committed
[nrf noup] mgmt: Handle pending slot requests
Interpret pending active slot requests while calculating the expected next slot to boot. Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent fcb3e3b commit f56418e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ static int read_directxip_state(int slot)
233233
}
234234
#endif /* defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT) */
235235

236+
#ifdef CONFIG_NRF_MCUBOOT_BOOT_REQUEST
237+
#include <bootutil/boot_request.h>
238+
#endif /* CONFIG_NRF_MCUBOOT_BOOT_REQUEST */
239+
236240
#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \
237241
defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT)
238242
int img_mgmt_get_next_boot_slot(int image, enum img_mgmt_next_boot_type *type)
@@ -285,6 +289,15 @@ int img_mgmt_get_next_boot_slot(int image, enum img_mgmt_next_boot_type *type)
285289
if (active_slot_state == DIRECT_XIP_BOOT_ONCE) {
286290
lt = NEXT_BOOT_TYPE_TEST;
287291
}
292+
#ifdef CONFIG_NRF_MCUBOOT_BOOT_REQUEST
293+
} else if (boot_request_get_preferred_slot(image) == other_slot) {
294+
if (other_slot_state == DIRECT_XIP_BOOT_FOREVER) {
295+
return_slot = other_slot;
296+
} else if (other_slot_state == DIRECT_XIP_BOOT_ONCE) {
297+
lt = NEXT_BOOT_TYPE_TEST;
298+
return_slot = other_slot;
299+
}
300+
#endif /* CONFIG_NRF_MCUBOOT_BOOT_REQUEST */
288301
} else if (img_mgmt_vercmp(&aver, &over) < 0) {
289302
if (other_slot_state == DIRECT_XIP_BOOT_FOREVER) {
290303
return_slot = other_slot;

0 commit comments

Comments
 (0)