[NCS 2.7.0] Sysbuild config for nRF5340 Audio with Serial Recovery DFU over USB CDC

Hi,

I upgraded my nRF5340 Audio application from NCS v2.5.0 to NCS v2.7.0 to be able updating the network core.

I noticed that in NCS v2.7.0, the nRF5340 Audio application was based on Sysbuild configuration and only the FOTA DFU was presented.

In my application I use the Serial Recovery over CDC ACM without external flash so I tried to base the upgrade to 2.7.0 on Case ID: 328874.

But after I made the Sysbuild changes, I get the same error as in Case ID: 328874:

FAILED: zephyr/CMakeFiles/zephyr.dir/C_/ncs/v2.7.0/bootloader/mcuboot/boot/boot_serial/src/boot_serial.c.obj 
C:\ncs\toolchains\ce3b5ff664\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DMBEDTLS_CONFIG_FILE=\"mcuboot-mbedtls-cfg.h\" -DNCS_APPLICATION_BOOT_BANNER_GIT_REPO -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DUSE_PARTITION_MANAGER=1 -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/ncs/v2.7.0/zephyr/kernel/include -IC:/ncs/v2.7.0/zephyr/arch/arm/include -IC:/ncs/v2.7.0/zephyr/include -IC:/nuance/leaudio_pod/ble/platform/nordic5340/build/mcuboot/zephyr/include/generated -IC:/ncs/v2.7.0/zephyr/soc/nordic -IC:/ncs/v2.7.0/zephyr/soc/nordic/nrf53/. -IC:/ncs/v2.7.0/zephyr/soc/nordic/common/. -IC:/ncs/v2.7.0/nrf/include -IC:/ncs/v2.7.0/nrf/tests/include -IC:/ncs/v2.7.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.7.0/zephyr/modules/cmsis/. -IC:/ncs/v2.7.0/modules/hal/nordic/nrfx -IC:/ncs/v2.7.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.7.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.7.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.7.0/modules/lib/zcbor/include -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/bootutil/include -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/boot_serial/include -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/bootutil/src -IC:/ncs/v2.7.0/modules/crypto/mbedtls/include -IC:/ncs/v2.7.0/modules/crypto/mbedtls/include/library -IC:/ncs/v2.7.0/modules/crypto/mbedtls/library -IC:/ncs/v2.7.0/zephyr/modules/mbedtls/configs -IC:/ncs/v2.7.0/zephyr/modules/mbedtls/include -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/bootutil/zephyr/.. -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/bootutil/zephyr/../include -IC:/ncs/v2.7.0/bootloader/mcuboot/boot/bootutil/zephyr/../../zephyr/include -isystem C:/ncs/v2.7.0/zephyr/lib/libc/minimal/include -isystem C:/ncs/v2.7.0/zephyr/lib/libc/common/include -isystem c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include -isystem c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include-fixed -isystem C:/ncs/v2.7.0/nrfxlib/crypto/nrf_cc312_platform/include -fno-strict-aliasing -Os -imacros C:/nuance/leaudio_pod/ble/platform/nordic5340/build/mcuboot/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.7.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.7.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.7.0=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -MD -MT zephyr/CMakeFiles/zephyr.dir/C_/ncs/v2.7.0/bootloader/mcuboot/boot/boot_serial/src/boot_serial.c.obj -MF zephyr\CMakeFiles\zephyr.dir\C_\ncs\v2.7.0\bootloader\mcuboot\boot\boot_serial\src\boot_serial.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/C_/ncs/v2.7.0/bootloader/mcuboot/boot/boot_serial/src/boot_serial.c.obj -c C:/ncs/v2.7.0/bootloader/mcuboot/boot/boot_serial/src/boot_serial.c
In file included from C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include/sysflash/sysflash.h:10,
                 from C:/ncs/v2.7.0/bootloader/mcuboot/boot/boot_serial/src/boot_serial.c:27:
C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h: In function '__flash_area_ids_for_slot':
C:/ncs/v2.7.0/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
      |                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~
C:/ncs/v2.7.0/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
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~
C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:67:9: note: in expansion of macro 'ALL_AVAILABLE_SLOTS'
   67 |         ALL_AVAILABLE_SLOTS
      |         ^~~~~~~~~~~~~~~~~~~
C:/ncs/v2.7.0/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
      |                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~
C:/ncs/v2.7.0/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
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~
C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:67:9: note: in expansion of macro 'ALL_AVAILABLE_SLOTS'
   67 |         ALL_AVAILABLE_SLOTS

prj.conf:

# nRF5340 Audio
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Nuance CDC ACM"
CONFIG_USB_DEVICE_PID=0x530A
CONFIG_USB_DEVICE_VID=0x1915
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n

CONFIG_NRF5340_AUDIO=y

CONFIG_SAMPLE_RATE_CONVERTER=y
CONFIG_SAMPLE_RATE_CONVERTER_FILTER_SIMPLE=y

# General
CONFIG_DEBUG=n
CONFIG_DEBUG_INFO=n
CONFIG_ASSERT=n
CONFIG_STACK_USAGE=y
CONFIG_THREAD_RUNTIME_STATS=y
CONFIG_STACK_SENTINEL=y
CONFIG_INIT_STACKS=y

# Uart driver
CONFIG_SERIAL=y

# Logging
CONFIG_LOG=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_LOG_TAG_MAX_LEN=2
CONFIG_LOG_TAG_DEFAULT="--"
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_BUFFER_SIZE=4096
CONFIG_USE_SEGGER_RTT=y
CONFIG_SD_LOG_LEVEL_OFF=y

# Suppress LOG_INF messages from hci_core
CONFIG_BT_HCI_CORE_LOG_LEVEL_WRN=y
CONFIG_AUDIO_DEV=2
CONFIG_TRANSPORT_CIS=y
CONFIG_AUDIO_SOURCE_I2S=y

Kconfig.sysbuild:

CONFIG_NRF_DEFAULT_IPC_RADIO=y
CONFIG_IPC_RADIO_BT=y

source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"

sysbuild.conf:

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

CONFIG_PM=n

CONFIG_BOOT_SWAP_SAVE_ENCTLV=n
CONFIG_BOOT_ENCRYPT_IMAGE=n

CONFIG_BOOT_BOOTSTRAP=n
CONFIG_BOOT_MAX_IMG_SECTORS=2048
CONFIG_MULTITHREADING=y
CONFIG_BOOT_ERASE_PROGRESSIVELY=y
CONFIG_SOC_FLASH_NRF_EMULATE_ONE_BYTE_WRITE_ACCESS=y


# 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

Omri.

Parents Reply Children
  • Hi Dejan,

    I saw that sample and I succeeded to build it without the sysbuild, but when I took the configuration to the ipc radio application, the build failed.

    How can I merge the network core bootloader sample configuration with the ipc radio application?

    Should I create child image in the ipc radio application with mcuboot.conf file that includes the network core bootloader sample configuration?

    regards,

    Omri

  • Hi Omri,

    It is not intended for ipc_radio to be built as a standalone application. There is a discussion which could provide some information how to use FOTA in audio application in NCS v2.7.0 - audio sample with FOTA

    In general, to enable net core updates, application should be built with these options:
    -DSB_CONFIG_SECURE_BOOT_NETCORE=y
    -DSB_CONFIG_NETCORE_IPC_RADIO=y
    -DSB_CONFIG_NETCORE_IPC_RADIO_BT_HCI_IPC=y
    -DSB_CONFIG_NETCORE_APP_UPDATE=y
    -DSB_CONFIG_BOOTLOADER_MCUBOOT=y
    Secure boot for application core can be disabled using 
    -DSB_CONFIG_SECURE_BOOT_APPCORE=n

    You can find more information in configuring b0 bootloadersecure bootenabling images and adding immutable bootloader.

    Best regards,
    Dejan

  • Hi Dejan,

    First, I'm looking for serial recovery solution and not FOTA solution.

    Second, the solution with Sysbuild return a build error as in Case  ID: 328874, so I'm looking for solution without Sysbuild configuration.

    The main problem with that approach, that in NCS v2.7.0 I can not build the IPC Radio as part of the nrf5340_audio application without the Sysbuild.

    The only thing I can do is to build it without Sysbuild as standalone and that's what I did.

    I build the nrf5340_audio application with serial recovery without sysbuild and flash the image to the nRF5340_Audio_DK app core.

    After that I flash the IPC Radio standalone image to the network core.

    Everything works fine.

    The problem in that solution is that I can update only the application image and not the network image in serial recovery mode.

    My suggest is to try to do the same as in NCS v2.5.0, the nrf5340_audio application will create empty network core with B0N and then take the precompiled IPC Radio HEX image and merge it by ble5-ctr-rpmsg_sign.py script.

    The problem is that I can not merge the IPC Radio HEX as is. I need to shift it in order to merge it.

    As in NCS v2.5.0 there were already precompiled shifted images:

    ble5-ctr-rpmsg_3393.hex - regular build, 

    ble5-ctr-rpmsg_shifted_3393.hex - shifted build

    and ble5-ctr-rpmsg_shifted_min_3393.hex - shifted build with min b0n flag.

    is there any guide how to shift HEX image so i could create shifted hex from the IPC Radio HEX?

    Regards,

    Omri

           

  • Hi Omri,

    Regarding shifting hex image, I have discussed your question with our developers. Shifting of hex files manually is tedious work, which is prone to errors, i.e. it is easy to do it wrong. It would be much easier if you could just build your application using sysbuild. However, this is not possible at the moment as you already know from the Case ID: 328874. It is recommended that you wait for the resolution of the case 328874.

    Best regards,
    Dejan

  • Hi Omri,

    I have reached out to our developers again. We will further look into this issue. I will get back to you as soon as I have some relevant information, probably during this or next week.

    Thank you for your patience.

    Best regards,
    Dejan

Related