DFU without mcumgr and SMP server

Hi!

I'm using an nRF52840 with Zephyr and I would like to know if it's possible to perform a DFU without using mcumgr. I would like to write the update to another memory slot and use MCUboot to perform the update. The reason for this is that I'm trying to update the nRF firmware from an ESP32 with ESP-IDF and FreeRTOS, which don't have an mcumgr client available. I've already included MCUboot and written/read random data to/from another memory slot using flash_write and flash_read. The problem now is what to write to the other memory slot and how to make MCUboot perform the update. Is it the content of zephyr.hex of the update that I should write to the other memory slot? How can I make MCUboot perform the update after I've written the update?

My prj.conf:

CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y


I'm using nRF Connect 2.2.0 and Zephyr 3.1.99. I'm open to other solutions, as long as it uses ESP32 to update the nRF52840.

Edit: I've finally made it work. In order to accomplish this, you need to follow these instructions:

  • Use the following configurations in the base image:
    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_IMG_MANAGER=y
    CONFIG_BOOTLOADER_MCUBOOT=y
  • Use the app_signed.hex of the update image, generated when you use CONFIG_BOOTLOADER_MCUBOOT=y to build the project
  • Correctly parse the app_update.hex and write it to the correct memory address, which would be:
    • address indicated in the app_update.hex file + image 1 slot flash offset - 0xc000
  • To correctly parse app_update.hex, check Intel HEX format
  • Image 1 slot flash offset can be obtained using FIXED_PARTITION_OFFSET(slot1_partition)
  • Call boot_request_upgrade(BOOT_UPGRADE_PERMANENT) when you are done
  • Important: in your update image, you have to call boot_write_img_confirmed() in order to confirm the update image

Hope this helps someone.

Related