[NCS 2.7.0] Sysbuild config for nrf5340 with DFU over BLE

Hi,

I am working with nrf5340 chip and I want to migrate from NCS 2.6.1 to NCS 2.7.0. I want therefore to apply recommendations: migrate to sysbuild.

With NCS 2.6.1 I was using principles described in https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-8-bootloaders-and-dfu-fota/topic/exercise-3-fota-over-bluetooth-low-energy/

However, I did not succeed to reach a similar configuration with sysbuild (I always have build errors) and I did not find a sample building DFU over BLE with sysbuild for nrf5340dk or a similar board.

So far, I started with zephyr/samples/sysbuild/with_mcuboot sample, with these modifications:

  • prj.conf:

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

  • sysbuild.conf

SB_CONFIG_BOOTLOADER_MCUBOOT=y

SB_CONFIG_PARTITION_MANAGER=y

SB_CONFIG_SECURE_BOOT_NETCORE=y

SB_CONFIG_NETCORE_APP_UPDATE=y
SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_BUILD=y
SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_APP=y
SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_NET=y

SB_CONFIG_NETCORE_HCI_IPC=y

Build is performed with this command:

west build --build-dir [...]/zephyr/samples/sysbuild/with_mcuboot/build [...]/zephyr/samples/sysbuild/with_mcuboot --pristine --board nrf5340dk/nrf5340/cpuapp --sysbuild

And so far, I am stuck with this error:

[...]/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h: In function '__flash_area_ids_for_slot':
[...]/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:48:37: error: 'PM_MCUBOOT_PRIMARY_1_ID' undeclared (first use in this function); did you mean 'PM_MCUBOOT_PRIMARY_ID'?
   48 | #define FLASH_AREA_IMAGE_1_SLOTS    PM_MCUBOOT_PRIMARY_1_ID, PM_MCUBOOT_SECONDARY_1_ID
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~
[...]/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
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~
[...]/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:67:9: note: in expansion of macro 'ALL_AVAILABLE_SLOTS'
   67 |         ALL_AVAILABLE_SLOTS
      |         ^~~~~~~~~~~~~~~~~~~
[...]/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:48:37: 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
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~
[...]/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
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~
[...]/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:67:9: note: in expansion of macro 'ALL_AVAILABLE_SLOTS'
   67 |         ALL_AVAILABLE_SLOTS
      |         ^~~~~~~~~~~~~~~~~~~
[...]/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
      |                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~
[...]/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
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~
[...]/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:67:9: note: in expansion of macro 'ALL_AVAILABLE_SLOTS'
   67 |         ALL_AVAILABLE_SLOTS
      |         ^~~~~~~~~~~~~~~~~~~

Could you please help me with this issue ?

Thanks and best regards

Parents
  • Hi,

    Here is from a previous case I had, and I was told:  said:

    "
    here's how you get network core updates working in sysbuild for smp_svr:copy pm_static.yml from thingy53 and put it in smp_svr/pm_static.ymlbuild with: cmake -GNinja -DBOARD=nrf5340dk/nrf5340/cpuapp -DSB_CONFIG_SECURE_BOOT_NETCORE=y -DSB_CONFIG_NETCORE_HCI_IPC=y -DSB_CONFIG_NETCORE_APP_UPDATE=y -DSB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y -DOVERLAY_CONFIG="overlay-bt.conf" -Dmcuboot_EXTRA_DTC_OVERLAY_FILE=/tmp/bb/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/ffs.overlay -Dsmp_svr_EXTRA_DTC_OVERLAY_FILE=/tmp/bb/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/ffs.overlay -Dmcuboot_CONFIG_UART_CONSOLE=n -Dmcuboot_CONFIG_MCUBOOT_SERIAL=y -Dmcuboot_CONFIG_MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD=y -Dmcuboot_CONFIG_BOOT_MAX_IMG_SECTORS=384 -DAPP_DIR=.. /tmp/bb/zephyr/share/sysbuildFlash device, you now have secure boot on network core, mcuboot (with network core update support and serial recovery), bluetooth hci_ipc on network core and smp_svr with bluetooth support
    "

    Does this work for you?

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd,

    Thanks, this helped me a lot. I have now almost a working demo config.

    I am now able to build and run sample code allowing to perform DFU over BLE of APP core.

    However, when I enable SB_CONFIG_NETCORE_APP_UPDATE, the nrf5340 is not able to boot after flashing. Do you have any idea ?

    Best regards

  • Good to hear!

    For this, it would be useful to get logs.

    kartapusse said:
    the nrf5340 is not able to boot after flashing.

    It is rarely the case that no logs are given at all.

    Try to enable logs in both the app and MCUboot.
    Do you get anything?

Reply Children
No Data
Related