mgmt/mcumgr/grp/img: No MCUboot flags setting in DirectXIP

It is no longer possible to select image for test or confirm
when MCUboot has been configured for DirectXIP.
MCUboot flags, in image trailer, are now ignored in DirectXIP
mode allowing to use entire slot for image upload.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
Dominik Ermel 2023-05-09 15:54:05 +00:00 committed by Carles Cufí
parent 0a5c4aba52
commit a763454c0b
2 changed files with 14 additions and 5 deletions

View File

@ -669,7 +669,11 @@ img_mgmt_my_version(struct image_version *ver)
static const struct mgmt_handler img_mgmt_handlers[] = {
[IMG_MGMT_ID_STATE] = {
.mh_read = img_mgmt_state_read,
#ifdef CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP
.mh_write = NULL
#else
.mh_write = img_mgmt_state_write,
#endif
},
[IMG_MGMT_ID_UPLOAD] = {
.mh_read = NULL,

View File

@ -124,13 +124,18 @@ img_mgmt_state_any_pending(void)
int
img_mgmt_slot_in_use(int slot)
{
uint8_t state_flags;
int active_slot = img_mgmt_active_slot(img_mgmt_active_image());
state_flags = img_mgmt_state_flags(slot);
return slot == active_slot ||
state_flags & IMG_MGMT_STATE_F_CONFIRMED ||
state_flags & IMG_MGMT_STATE_F_PENDING;
#ifndef CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP
uint8_t state_flags = img_mgmt_state_flags(slot);
if (state_flags & IMG_MGMT_STATE_F_CONFIRMED ||
state_flags & IMG_MGMT_STATE_F_PENDING) {
return 1;
}
#endif
return (active_slot == slot);
}
/**