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

Fullscreen
1
2
3
4
# Enable bootloaders for both cores
SB_CONFIG_BOOTLOADER_MCUBOOT=y
SB_CONFIG_SECURE_BOOT_NETCORE=y
SB_CONFIG_NETCORE_APP_UPDATE=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

sysbuild/mcuboot.conf
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The build error I am receiving during the building of the final image, mcuboot, is:
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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
Parents
  • Hi,

    Seems you did the following

    1. Serial Recovery alone without sysbuild
    2. Serial Recovery alone with sysbuild
    3. Audio sample with sysbuild
    4. Audio sample with Serial Recovery and Sysbuild

    Can you try 2, and see how that goes?

    Regards,
    Sigurd Hellesvik

  • Hi  ,

    Thanks for your response.

    I just attempted the same with the peripheral_uart Nordic sample. There is a brief description on how to enable network core serial recovery with the provided overlay files: https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/bluetooth/peripheral_uart/README.html#activating_sample_extensions

    However, the instructions don't work. Either by providing the overlays on the command line, or by copying them in manually. The build error is the same as the above.

    Thanks,

    Sean

  • The latest I tried was NCS v2.7.0-rc2

  • FARLY7 said:
    However, the instructions don't work. Either by providing the overlays on the command line, or by copying them in manually. The build error is the same as the above.

    I try to build, and I get another error than you do.

    How did you upgrade your NCS?

    This is the build command I used from CLI:

    Fullscreen
    1
    west build -b nrf5340dk/nrf5340/cpuapp --sysbuild -- -DEXTRA_CONF_FILE=nrf5340dk_app_sr_net.conf -Dmcuboot_EXTRA_CONF_FILE=nrf5340dk_mcuboot_sr_net.conf
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Does this match yours?

  • Hi  ,

    If I run your command on NCS commit #8b1fd619 from main, the project builds, but wrongly. It doesn't include MCUBoot or B0n. See below:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    ~/w/a/aura-f/nrf/sa/bl/peripheral_uart @8b1fd619 *2 !20 ?14 ❯ west build -b nrf5340dk/nrf5340/cpuapp --sysbuild -- -DEXTRA_CONF_FILE=nrf5340dk_app_sr_net.conf -Dmcuboot_EXTRA_CONF_FILE=nrf5340dk_mcuboot_sr_net.conf
    -- west build: generating a build system
    Loading Zephyr module(s) (Zephyr base (cached)): sysbuild_default
    -- Cache files will be written to: /Users/FARLY7/Library/Caches/zephyr
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf5340dk, qualifiers: nrf5340/cpuapp
    Parsing /Users/FARLY7/workspace/aura/aura-firmware/nrf/samples/bluetooth/peripheral_uart/Kconfig.sysbuild
    Loaded configuration '/Users/FARLY7/workspace/aura/aura-firmware/nrf/samples/bluetooth/peripheral_uart/build/_sysbuild/empty.conf'
    Merged configuration '/Users/FARLY7/workspace/aura/aura-firmware/nrf/samples/bluetooth/peripheral_uart/sysbuild.conf'
    No change to configuration in '/Users/FARLY7/workspace/aura/aura-firmware/nrf/samples/bluetooth/peripheral_uart/build/zephyr/.config'
    No change to Kconfig header in '/Users/FARLY7/workspace/aura/aura-firmware/nrf/samples/bluetooth/peripheral_uart/build/_sysbuild/autoconf.h'
    --
    *************************************
    * Running CMake for peripheral_uart *
    *************************************
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: /Users/FARLY7/workspace/aura/aura-firmware/nrf/samples/bluetooth/peripheral_uart
    -- CMake version: 3.29.5
    -- Cache files will be written to: /Users/FARLY7/Library/Caches/zephyr
    -- Zephyr version: 3.6.99 (/Users/FARLY7/workspace/aura/aura-firmware/zephyr)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    What error do you receive? It definitely seems like something is wrong with Sysbuild + nRF5340 serial recovery.

  • Yes this is the same error (Kconfig override warnings) as I see on my side as well.
    Thank you for verifying this!

    I have reported this as a bug internally.

    In this case, can I suggest that you instead try to build my serial recovery sample with sysbuild instead?
    You will have to make some changes to it, as it can no longer use the child_image folder for configs, but instead must follow sysbuild docs on how to apply mcuboot configurations from your project.

  • Hi Sigurd,

    Thank you for reporting the bug.

    I feel like I have been around the houses enough trying many different configurations with Sysbuild (including your example) to try and get it to work, and been unsuccessful every time. I always get the same error as in my original message. I was trying for 2-3 days haha :)

    Could you try to enable it in your own mcuboot_netcore_serial_recovery example instead? I am sure you will have the same error I have!

    As I said, I already tried with nrf5340_audio and peripheral_uart samples, both with the same error. I have now run out of ideas and am convinced it must be another bug, or I have been missing something that is not documented.

    FYI, I can successfully enable serial recovery through non-sysbuild builds, which is what I'm reverting to for now.

    Thanks,

    Sean

Reply
  • Hi Sigurd,

    Thank you for reporting the bug.

    I feel like I have been around the houses enough trying many different configurations with Sysbuild (including your example) to try and get it to work, and been unsuccessful every time. I always get the same error as in my original message. I was trying for 2-3 days haha :)

    Could you try to enable it in your own mcuboot_netcore_serial_recovery example instead? I am sure you will have the same error I have!

    As I said, I already tried with nrf5340_audio and peripheral_uart samples, both with the same error. I have now run out of ideas and am convinced it must be another bug, or I have been missing something that is not documented.

    FYI, I can successfully enable serial recovery through non-sysbuild builds, which is what I'm reverting to for now.

    Thanks,

    Sean

Children