Upgrading large image without external flash

Hello,

We are currently implementing a custom DFU process for one of our client. They need to be able to upgrade the cores images, which are read from an SD-card. We already have evaluated the DFU capabilities of Zephyr/nRF and could successfully update the Application Core using a minimal test app, using DFUTarget.

The issue is that our client actual image has become pretty big in size (>700KB) thus making the dual slots upgrade impossible using the internal flash alone, as the maximum slot size for MCUBoot update is ~500KB. Having an external flash is not an option as the HW cannot be changed much from now on.

What are the options for such scenario? Here are some investigation about potential solutions:

  1. Manually do the upgrade process, using the SD-Card as the secondary slot, managing the validation and the revert process in case something goes wrong. This means using a single slot setup (only the primary slot), which will use the whole flash minus the bootloader(s) size. The upgrade process would be in MCUBoot.
  2. Not using a dual slot for the image and having an upgradable MCUBoot which handles the upgrade at boot, tries to upgrade the image N times, and fails if the upgrade did not succeed. In that case, the previous image would still be possible to flash, as the upgrade code resides in MCUBoot, but you'll have to update the files in the SD-Card and do a recovery.

In any case, I think having the upgrade process in MCUBoot is mandatory, as the application wont be able to upgrade itself with one slot. In that case, how would one implement a custom upgrade process in MCUBoot? Using hooks? Modifying the MCUBoot code?

Here is my setup:

- NCS 2.6.1

- Using nRF Connect VSCode extension

- Toolchain 2.6.1

- Board nRF5340 DK 

Don't hesitate if you need anything else to answer the question.

Thanks a lot in advance!

David

Related