How to enable Serial Recovery mode on the nrf5340_audio application (Sysbuild)?

Hi there,

The nrf5340_audio application provides a -DFILE_SUFFIX=fota overlay that adds FOTA capabilities to the application. This FOTA is introduced via Sysbuild configuration files. This configuration compiles successfully.

Instead of FOTA, I would like to enable Serial Recovery mode with CDC ACM transport.

I have successfully enabled this mode on the nRF5340 with other samples that don't use Sysbuild. I achieved this by following the relevant samples at https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/serial_recovery. This allows me to update the application and network core with two separate .bin files contained within the dfu_application.zip. I believe this is called non-simultaneous DFU.

However, I can't get the same KConfig options working in Sysbuild in the nrf5340_audio application. 

My file structure is:

sysbuild.conf

# Enable bootloaders for both cores
SB_CONFIG_BOOTLOADER_MCUBOOT=y
SB_CONFIG_SECURE_BOOT_NETCORE=y
SB_CONFIG_NETCORE_APP_UPDATE=y

sysbuild/mcuboot.conf
CONFIG_MAIN_STACK_SIZE=10240
# Flash
CONFIG_FLASH=y
CONFIG_FPROTECT=y

# MCUBoot serial
CONFIG_MCUBOOT_SERIAL=y
CONFIG_MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD=y

# Decrease memory footprint
CONFIG_CBPRINTF_NANO=y
CONFIG_TIMESLICING=n
CONFIG_BOOT_BANNER=n
CONFIG_CONSOLE=n
CONFIG_CONSOLE_HANDLER=n
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=n
CONFIG_USE_SEGGER_RTT=n
CONFIG_LOG=n
CONFIG_RESET_ON_FATAL_ERROR=n

# The following configurations are required to support serial recovery of the
# network image
CONFIG_PCD_APP=y

# The network core cannot access external flash directly. The flash simulator must be used to
# provide a memory region that is used to forward the new firmware to the network core.
CONFIG_FLASH_SIMULATOR=y
CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y
CONFIG_FLASH_SIMULATOR_STATS=n

CONFIG_BOOT_IMAGE_ACCESS_HOOKS=y
CONFIG_NRF53_RECOVERY_NETWORK_CORE=y

CONFIG_MCUBOOT_INDICATION_LED=y

# My additions
CONFIG_BOOT_SERIAL_CDC_ACM=y
# CONFIG_PM_PARTITION_SIZE_MCUBOOT=0xE800
CONFIG_PM_PARTITION_SIZE_MCUBOOT=0xFC00

CONFIG_USB_DEVICE_VID=0x1915
CONFIG_USB_DEVICE_PID=0x5300
The build error I am receiving during the building of the final image, mcuboot, is:
In file included from /Users/FARLY7/workspace/aura/aura-firmware/bootloader/mcuboot/boot/zephyr/include/sysflash/sysflash.h:10,
from /Users/FARLY7/workspace/aura/aura-firmware/bootloader/mcuboot/boot/bootutil/src/bootutil_priv.h:33,
from /Users/FARLY7/workspace/aura/aura-firmware/bootloader/mcuboot/boot/bootutil/src/tlv.c:24:
/Users/FARLY7/workspace/aura/aura-firmware/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h: In function '__flash_area_ids_for_slot':
/Users/FARLY7/workspace/aura/aura-firmware/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:48:62: error: 'PM_MCUBOOT_SECONDARY_1_ID' undeclared (first use in this function); did you mean 'PM_MCUBOOT_SECONDARY_ID'?
48 | #define FLASH_AREA_IMAGE_1_SLOTS PM_MCUBOOT_PRIMARY_1_ID, PM_MCUBOOT_SECONDARY_1_ID
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/FARLY7/workspace/aura/aura-firmware/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:55:29: note: in expansion of macro 'FLASH_AREA_IMAGE_1_SLOTS'
55 | FLASH_AREA_IMAGE_1_SLOTS
| ^~~~~~~~~~~~~~~~~~~~~~~~
/Users/FARLY7/workspace/aura/aura-firmware/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:67:9: note: in expansion of macro 'ALL_AVAILABLE_SLOTS'
67 | ALL_AVAILABLE_SLOTS
| ^~~~~~~~~~~~~~~~~~~
/Users/FARLY7/workspace/aura/aura-firmware/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:48:62: note: each undeclared identifier is reported only once for each function it appears in
48 | #define FLASH_AREA_IMAGE_1_SLOTS PM_MCUBOOT_PRIMARY_1_ID, PM_MCUBOOT_SECONDARY_1_ID
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/FARLY7/workspace/aura/aura-firmware/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:55:29: note: in expansion of macro 'FLASH_AREA_IMAGE_1_SLOTS'
55 | FLASH_AREA_IMAGE_1_SLOTS
| ^~~~~~~~~~~~~~~~~~~~~~~~
/Users/FARLY7/workspace/aura/aura-firmware/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:67:9: note: in expansion of macro 'ALL_AVAILABLE_SLOTS'
67 | ALL_AVAILABLE_SLOTS
| ^~~~~~~~~~~~~~~~~~~
[95/322] Building C object CMakeFiles/app.dir/flash_map_extended.c.obj
It seems the error is perhaps related to partitions and slots, so I think there is a missing/wrong KConfig option or something not taking effect?
Thanks a lot,
Sean
Related