NRF5340 Simultaneous multi image dfu. Only Appcore image is updated

Hello!

I'm trying to add simultaneus multi-image DFU to my custom nRF5340 board (nRF Connect SDK v2.6.0) but I can't update the network core, only the appcore is updating.

This is what I have done so far:

  1. Create a multi-image binary using
    python .\dfu_multi_image_tool.py create --image 0 \build\zephyr\app_update.bin --image 1 \build\centralNetworkCore\zephyr\zephyr.bin dfu_multi_image.bin
  2. Send the multi-image binary file to the application core using a custom protocol
  3. Process the multi-image binary using DFU Multi Image library
  4. Write both images to their respective secondary partition (on external flash) using DFU Target library
  5. Restart the device

This is working fine as you can see from this log

The problem is that only the application core is getting updated

It's like MCUboot detects that there is a new image on index 1 (network core) but ignore it.

I've been using this un-official example from  



This is my partition table (Memory report):

flash_primary0x00000000 - 0x000fffff
Address End Partition Size Size (hex)
0x00000000 0x0000ffff

mcuboot
64.00 kB 0x10000
0x00010000 0x00083fff

mcuboot_primary
464.00 kB 0x74000
0x00010000 0x000101ff
└ 
mcuboot_pad
512 bytes 0x200
0x00010200 0x00083fff
└ 
mcuboot_primary_app
463.50 kB 0x73e00
0x00010200 0x00083fff
 └ 
app
463.50 kB 0x73e00
0x00084000 0x000fffff

EMPTY_0
496.00 kB 0x7c000
external_flash0x00000000 - 0x01ffffff
Address End Partition Size Size (hex)
0x00000000 0x00073fff

mcuboot_secondary
464.00 kB 0x74000
0x00074000 0x000b3fff

mcuboot_secondary_1
256.00 kB 0x40000
0x000b4000 0x010b3fff

littlefs_storage
16.00 MB 0x1000000
0x010b4000 0x01ffffff

free_storage
15.30 MB 0xf4c000
0x02000000 0x01ffffff
└ 
external_flash
0 bytes 0x0
ram_flash0x00000000 - 0x0003ffff
Address End Partition Size Size (hex)
0x00000000 0x0003ffff

mcuboot_primary_1
256.00 kB 0x40000
0x00040000 0x0003ffff

ram_flash
0 bytes 0x0
sram_primary0x20000000 - 0x2007ffff
Address End Partition Size Size (hex)
0x20000000 0x20000fff

shared_sram
4.00 kB 0x1000
0x20001000 0x2005efff

sram_primary
376.00 kB 0x5e000
0x2005f000 0x2006efff

rpmsg_nrf53_sram
64.00 kB 0x10000
0x2006f000 0x20070fff

pcd_sram
8.00 kB 0x2000
0x20071000 0x2007ffff

networkCore_sram
60.00 kB 0xf000
otp0x00ff8100 - 0x00ff83fb
Address End Partition Size Size (hex)
0x00ff8100 0x00ff83fb

otp
764 bytes 0x2fc

This is my application prj.conf:

#
# Main configurations
#

CONFIG_MAIN_STACK_SIZE=8092
CONFIG_THREAD_NAME=y

# CPP and C
CONFIG_CPP=y
CONFIG_STD_CPP14=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

# DBG optimization
CONFIG_DEBUG_OPTIMIZATIONS=n
CONFIG_SPEED_OPTIMIZATIONS=y
CONFIG_THREAD_CUSTOM_DATA=y

# Some command handlers require a large stack.
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=4096

# Bigger ISR stack size required for audio.c/audioProcessBlock() local buffers
#   STACK_AUDIO_BACKGROUND_THREAD does not solve this given audioProcessBlock()
#   is called from an ISR context. Default 2048 is not enough.
CONFIG_ISR_STACK_SIZE=6144

#
# NetworkCore 
#

# Enable netcore
CONFIG_BOARD_ENABLE_CPUNET=y
CONFIG_PARTITION_MANAGER_ENABLED=y
CONFIG_NCS_SAMPLE_EMPTY_NET_CORE_CHILD_IMAGE=n
CONFIG_INCLUDE_NET_CORE_IMAGE=y

# The following configurations are required to support simultaneous multi image update
# Netcore upgrade
CONFIG_PCD_APP=y
CONFIG_NRF53_UPGRADE_NETWORK_CORE=y
CONFIG_UPDATEABLE_IMAGE_NUMBER=2
CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
CONFIG_ADD_MCUBOOT_MEDIATE_SIM_FLASH_DTS=y

#
# MCUMGR
# 

# Enable mcumgr
CONFIG_NET_BUF=y
CONFIG_ZCBOR=y
CONFIG_MCUMGR=y		

# Ensure an MCUboot-compatible binary is generated
CONFIG_BOOTLOADER_MCUBOOT=y

# Enable most core commands
CONFIG_STREAM_FLASH_ERASE=y
CONFIG_STREAM_FLASH=y
CONFIG_IMG_MANAGER=y	

#
# USB
#

CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Constellation"
CONFIG_USB_DEVICE_MANUFACTURER="MJP audio designs"
CONFIG_USB_COMPOSITE_DEVICE=y
CONFIG_USB_DEVICE_VID=0x20b1
CONFIG_USB_DEVICE_PID=0x0401

#
# SPI
#
CONFIG_NRFX_SPIS1=y

#
# UART
#

CONFIG_UART_USE_RUNTIME_CONFIGURE=y
CONFIG_NRF53_SYNC_RTC=n
CONFIG_LOG_PRINTK=n 
CONFIG_RING_BUFFER=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_LINE_CTRL=y
CONFIG_PM_DEVICE=y
CONFIG_UART_2_INTERRUPT_DRIVEN=n
CONFIG_UART_ASYNC_API=y
CONFIG_UART_2_ASYNC=y

# LOG subsystem related configs
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y

#
# CODECS
#

# I2C configuration
CONFIG_I2C=y

# Enable I2S
CONFIG_NRFX_I2S0=y

# Cache
CONFIG_NRF_ENABLE_CACHE=y

# DSP
CONFIG_FPU=y
CONFIG_CMSIS_DSP=y
CONFIG_CMSIS_DSP_ROUNDING=y

#
# QSPI flash
#

CONFIG_NORDIC_QSPI_NOR=y
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y

#
# LittleFS
#

CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_FS_LITTLEFS_CACHE_SIZE=128
CONFIG_FS_LITTLEFS_LOOKAHEAD_SIZE=128

CONFIG_DFU_MULTI_IMAGE=y
CONFIG_DFU_MULTI_IMAGE_MAX_IMAGE_COUNT=2
#CONFIG_DFU_MULTI_IMAGE_PACKAGE_BUILD=y
#Not working, see: https://devzone.nordicsemi.com/f/nordic-q-a/90503/ncs-2-0-custom-child-image-mcuboot-build

CONFIG_DFU_TARGET=y

This is my /child_image/mcuboot.conf:

CONFIG_MCUBOOT_BUILD_STRATEGY_FROM_SOURCE=n

# The following configurations are required to support simultaneous multi image update
CONFIG_FLASH=y
CONFIG_FPROTECT=y
CONFIG_PCD_APP=y
CONFIG_FLASH_SIMULATOR=y
CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y
CONFIG_FLASH_SIMULATOR_STATS=n
CONFIG_NORDIC_QSPI_NOR=y
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16

CONFIG_NRF53_MULTI_IMAGE_UPDATE=y
CONFIG_UPDATEABLE_IMAGE_NUMBER=2

CONFIG_BOOT_UPGRADE_ONLY=y
CONFIG_BOOT_IMAGE_ACCESS_HOOKS=y
CONFIG_BOOT_IMAGE_ACCESS_HOOK_NRF5340=y

CONFIG_UART_CONSOLE=y

This is my /child_image/mcuboot.overlay:

/ {
	chosen {
		nordic,pm-ext-flash = &mx25r64;
	};
};

Help getting the simultaneous DFU working for both cores will be much appreciated!

Regards,

Tomás

Related