We are using NRF5340 and interface with a host system via USB. As the USB stack supports the DFU device class, we plan to use that for firmware updates, and use dfu-util on the host side. We want to implement the update in the bootloader to remove the requirement for external flash for the second firmware slot.
Is this supported at all?
I have seen a similar issue, but that discusses the possibility of simultaneous update and does not show how the network image can be downloaded: devzone.nordicsemi.com/.../use-dfu-util-to-perform-multi-image-dfu-from-application
Downloading works well with the application image, using the following command line:
dfu-util -d 1915:b171 -e
dfu-util -d 1915:b172 -D app_image.bin
However, I have not succeeded in updating the network core by issuing the following command:
dfu-util -d 1915:b172 -D net_image.bin
The configuration we use:
sysbuild.conf
SB_CONFIG_BOOTLOADER_MCUBOOT=y SB_CONFIG_MCUBOOT_MODE_SINGLE_APP=y # Make the net core image updatable and signed SB_CONFIG_SECURE_BOOT_NETCORE=y SB_CONFIG_NETCORE_APP_UPDATE=y
prj.conf for MCUBOOT
CONFIG_MAIN_STACK_SIZE=10240 CONFIG_SINGLE_APPLICATION_SLOT=y CONFIG_FLASH=y CONFIG_BOOT_USB_DFU_WAIT=y CONFIG_BOOT_USB_DFU_WAIT_DELAY_MS=60000 CONFIG_USB_DFU_WILL_DETACH=y CONFIG_USB_DFU_ENABLE_UPLOAD=n CONFIG_USB_DFU_REBOOT=n CONFIG_BOOT_USB_DFU_NO_APPLICATION=y # PID and VID are the same as in application CONFIG_USB_DEVICE_PID=0xb171 CONFIG_USB_DEVICE_VID=0x1915 # PID in DFU mode is one higher than during normal operation CONFIG_USB_DEVICE_DFU_PID=0Xb172
pm_static.yml
app: address: 0x20200 region: flash_primary size: 0xcfe00 mcuboot: address: 0x0 region: flash_primary size: 0x20000 mcuboot_pad: address: 0x20000 region: flash_primary size: 0x200 mcuboot_primary: address: 0x20000 orig_span: &id001 - mcuboot_pad - app region: flash_primary size: 0xd0000 span: *id001 mcuboot_primary_app: address: 0x20200 orig_span: &id002 - app region: flash_primary size: 0xcfe00 span: *id002 settings_storage: address: 0xf0000 region: flash_primary size: 0x10000 mcuboot_primary_1: address: 0x0 size: 0x38000 device: flash_ctrl region: ram_flash