We are trying to implement Direct-XIP FOTA updates in NCS 2.2.0 and nrf52832.
I've been able to get around a NCS built issue Direct-XIP MCUboot both images have the same version , and I am now able to Flash MCUboot + 0 image slot, but I can not consistently update the device using the Device Manager Android App (Version 1.6.0). Transferring an image to the second slot is ok, and the bootloader correctly loads it (if the version number is higher). However, the new image can not be confirmed and gets deleted on the next reboot.
Some more digging suggests that NCS/Zephyr's imgmgt just doesn't really support Direct-XIP.
Issues include the baked in assumption that slot0 is always running (which it isn't):
// img_mgmg_config.h
#define IMG_MGMT_BOOT_CURR_SLOT 0
// img_mgmt_state.c:93
/* Slot 0 is always active. */
/* XXX: The slot 0 assumption only holds when running from flash. */
if (query_slot == IMG_MGMT_BOOT_CURR_SLOT) {
flags |= IMG_MGMT_STATE_F_ACTIVE;
}
But the issues run deeper than imgmgt. The application can't even set itself to being confirmed. As far as I can tell, boot_set_confirmed_multi(int image_index) in bootutil_public.c also assumes that the currently running application is in slot0 and will set that one to confirmed, even if called from an app running in slot 1!
Like I said in the previous ticket, the documentation is rather sparse. https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_dev/bootloaders_and_dfu/index.html suggests in the Table that Direct-XIP is supported. Then in https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/mcuboot/readme-ncs.html it also suggests that all you have to do is enable the CONFIG_BOOT_BUILD_DIRECT_XIP_VARIANT.
But looking at the MCUBOOT discussion about a lack of support in boot-util (https://github.com/mcu-tools/mcuboot/discussions/1474) and the "support XIP in zephyr" issue https://github.com/zephyrproject-rtos/zephyr/issues/27673 a bunch of work is still required to make Direct-xip work in practice.
So my question is:
Is Direct-XIP in NCS actually not yet supported, even though it says it is? If not, can the documentation be updated to warn users like me? What would the required steps be to support it? If I'm getting this totally wrong, and it is well-supported, how do I make the image sticky (confirmed) after a DFU?
I hope I'm wrong and haven't just put hours into trying to get something working that just isn't there yet.