diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index f2dea609958..988c06c4bc4 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -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, diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c index cbd0e63a851..9f04215760e 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c @@ -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); } /**