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

Hi there,

I have successfully enabled CDC ACM Serial Recovery mode on the nRF5340, which 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.

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.

Eg. with the below values in the application prj.conf, and the serial recovery specific configuration values in the mcuboot.conf.

CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_NRF53_UPGRADE_NETWORK_CORE=y
CONFIG_ADD_MCUBOOT_MEDIATE_SIM_FLASH_DTS=y

I have this working on any of the samples. However, I would like to enable it on the nrf5340_audio application.
I am having some trouble because this application uses Sysbuild, and the KConfig values are completely different. Enabling the KConfig values above do not take affect in this application.
There doesn't seem to be any documentation on how to enable the same CDC ACM Serial Recovery mode (App and Net core) through this Sysbuild?
Could you tell me which Sysbuild KConfig values are required to enable CDC ACM Serial Recovery non-simultaneous DFU mode?
Thanks a lot,
Sean
  • Hi!

    Sysbuild will be supported in the upcoming nRF Connect SDK(NCS) v2.7.0.

    For older versions of NCS, Sysbuild is not supported. 

    I would like to enable it on the nrf5340_audio application.
    I am having some trouble because this application uses Sysbuild

    In NCS 2.6.x use this application without Sysbuild.

    Please wait for NCS 2.7.0 before trying to use Sysbuild.

  • Hi  

    Thanks for your response.

    I am using the main branch of NCS. Sysbuild does seem to be present and working? Or is it not finished yet?

    How do I use this application without Sysbuild then? There are no sysbuild related flags passed when building. For example, —sysbuild, like is normally seen in other Zephyr samples to enable sysbuild configuration.

  • FARLY7 said:
    I am using the main branch of NCS.

    Is there a reason for this? I would recommend using a relased version, the main branch is in active development and can sometimes be unstable.

  • Yes, LE Audio and the nrf5340_audio application are experimental, so I want to make sure I am closely following the changes being made.

    Do you have an answer to my original question? Either how can I enable serial recovery mode with Sysbuild, or as you are now suggesting, disable sysbuild on the nrf5340_application?

    How do I use this application without Sysbuild then? There are no sysbuild related flags passed when building. For example, —sysbuild, like is normally seen in other Zephyr samples to enable sysbuild configuration.

    I think it's better not to disable sysbuild if it's in a working state? I believe the NCS 2.7.0 release is at the end of June, so really not that far.

  • Hi  ,

    I forgot to mention that sysbuild works fine as I am able to compile the nr5340_audio application with the FOTA configuration with the -DSUFFIX=fota as per the application documentation. So I don't think disabling sysbuild is the correct approach. Even if it does work, it is not a permanent solution as NCS 2.7.0 will be released in only a few weeks.

    Can you please help with my original question about how I can enable serial recovery mode on the nrf5340_audio application?

    FYI The error I am facing is in the building of the final image, mcuboot. Perhaps, this will give you a clue as to what I am missing?

    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

    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
    

    I also disable some unnecessary SD features in sysbuild/ipc_radio/prj.conf in order to free up network flash to allow for the b0n bootloader.

    Thanks,

    Sean 

Related