BT FOTA with custom nRF5340 network core

Hi
We would like to use the nRF5340 with a custom network core image that runs the full Bluetooth stack and I have gotten it to work with sysbuild. However, we would like to enable FOTA over Bluetooth also. 
I have a working example with Mcuboot and main application image on the application core, and b0n-bootloader and network image on the network core and it works fine. I have also managed to enable SMP server and can use OS commands when connecting with nRF Connect from my phone, but I can't get image manager to work. It gives some warnings about flash etc. Would it even be possible to have it setup this way? Can the network core run the DFU/FOTA process and work together with mcuboot that is on the application core? 

The reason for this is that we want our application to have minimal amount of interruptions, and having the whole BT stack on the network core seems to otherwise work really good.

Also on top of that we would preferable like to do this without external flash, and I have gotten FOTA to work with only internal flash. But that meant that I had to abandon the custom network image and run with the HCI_IPC image.

nRF Connect SDK v2.9.0

Toolchain v2.9.0

Kind regards

Robert

Parents
  • Hi,

    If you have everything that's specific for BLE, and the netcore don't have any access to the qspi/spi connected to the external flash, then you will need some way to route the transport of the image from netcore -> appcore -> external flash -> mcuboot_secondary partition while uploading.

    I'm not certain that this solution is possible. What warnings are you getting?

    Kind regards,
    Andreas

  • Hi,
    That's the transport-chain I had in mind, except maybe external flash if that can be avoided.

    When building my custom net image I have these among my configs: 

    CONFIG_NET_BUF=y
    CONFIG_MCUMGR=y
    CONFIG_MCUMGR_GRP_OS=y
    CONFIG_MCUMGR_GRP_OS_BOOTLOADER_INFO=y
    CONFIG_ZCBOR=y
    CONFIG_MCUMGR_TRANSPORT_BT=y

    Which allows me to run some OS manager commands.
    When I add  the configs for image manager however I get build errors. 

    Config: 
    CONFIG_MCUBOOT_BOOTUTIL_LIB=y
    CONFIG_IMG_MANAGER=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_STREAM_FLASH=y
    CONFIG_MCUMGR_GRP_IMG_CLIENT=y
    CONFIG_MCUMGR_GRP_IMG=y
    CONFIG_DFU_TARGET=y

    Errors:
    C:/ncs/v2.9.0/bootloader/mcuboot/boot/bootutil/include/bootutil/bootutil_public.h:44:10: fatal error: flash_map_backend/flash_map_backend.h: No such file or directory
    44 | #include <flash_map_backend/flash_map_backend.h>

    C:/ncs/v2.9.0/bootloader/mcuboot/boot/bootutil/include/bootutil/fault_injection_hardening.h:57:10: fatal error: mcuboot_config/mcuboot_config.h: No such file or directory
    57 | #include "mcuboot_config/mcuboot_config.h"

    C:/ncs/v2.9.0/bootloader/mcuboot/boot/bootutil/include/bootutil/bootutil_public.h:44:10: fatal error: flash_map_backend/flash_map_backend.h: No such file or directory
    44 | #include <flash_map_backend/flash_map_backend.h>

    I suspect this is because Mcuboot isn't completely part of the net image build as it would usually in an application image build. If I configure CONFIG_BOOTLOADER_MCUBOOT=y in my net image it think it attempted and failed to add mcuboot as bootloader for the net core and I don't want that.

    Maybe I'm missing some other configs?
    I guess I'm wondering if it is even possible to configure it this way?

    There will be some sort of communication between the cores, so I think I could set up a way to transport the image to the application core if I can get the network core to accept image uploads.


    EDIT: 
    Adding CONFIG_FLASH_MAP=y to the network core I get this error instead.

    /dfu/img_util/flash_img.c
    In file included from C:/ncs/v2.9.0/zephyr/include/zephyr/storage/flash_map.h:300,
    from C:/ncs/v2.9.0/zephyr/subsys/dfu/img_util/flash_img.c:13:
    C:/ncs/v2.9.0/zephyr/subsys/dfu/img_util/flash_img.c: In function 'flash_img_init':
    C:/ncs/v2.9.0/nrf/include/flash_map_pm.h:47:22: error: 'PM_mcuboot_primary_ID' undeclared (first use in this function); did you mean 'PM__mcuboot_primary_ID'?
    47 | #define PM_ID(label) PM_##label##_ID
    | ^~~
Reply
  • Hi,
    That's the transport-chain I had in mind, except maybe external flash if that can be avoided.

    When building my custom net image I have these among my configs: 

    CONFIG_NET_BUF=y
    CONFIG_MCUMGR=y
    CONFIG_MCUMGR_GRP_OS=y
    CONFIG_MCUMGR_GRP_OS_BOOTLOADER_INFO=y
    CONFIG_ZCBOR=y
    CONFIG_MCUMGR_TRANSPORT_BT=y

    Which allows me to run some OS manager commands.
    When I add  the configs for image manager however I get build errors. 

    Config: 
    CONFIG_MCUBOOT_BOOTUTIL_LIB=y
    CONFIG_IMG_MANAGER=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_STREAM_FLASH=y
    CONFIG_MCUMGR_GRP_IMG_CLIENT=y
    CONFIG_MCUMGR_GRP_IMG=y
    CONFIG_DFU_TARGET=y

    Errors:
    C:/ncs/v2.9.0/bootloader/mcuboot/boot/bootutil/include/bootutil/bootutil_public.h:44:10: fatal error: flash_map_backend/flash_map_backend.h: No such file or directory
    44 | #include <flash_map_backend/flash_map_backend.h>

    C:/ncs/v2.9.0/bootloader/mcuboot/boot/bootutil/include/bootutil/fault_injection_hardening.h:57:10: fatal error: mcuboot_config/mcuboot_config.h: No such file or directory
    57 | #include "mcuboot_config/mcuboot_config.h"

    C:/ncs/v2.9.0/bootloader/mcuboot/boot/bootutil/include/bootutil/bootutil_public.h:44:10: fatal error: flash_map_backend/flash_map_backend.h: No such file or directory
    44 | #include <flash_map_backend/flash_map_backend.h>

    I suspect this is because Mcuboot isn't completely part of the net image build as it would usually in an application image build. If I configure CONFIG_BOOTLOADER_MCUBOOT=y in my net image it think it attempted and failed to add mcuboot as bootloader for the net core and I don't want that.

    Maybe I'm missing some other configs?
    I guess I'm wondering if it is even possible to configure it this way?

    There will be some sort of communication between the cores, so I think I could set up a way to transport the image to the application core if I can get the network core to accept image uploads.


    EDIT: 
    Adding CONFIG_FLASH_MAP=y to the network core I get this error instead.

    /dfu/img_util/flash_img.c
    In file included from C:/ncs/v2.9.0/zephyr/include/zephyr/storage/flash_map.h:300,
    from C:/ncs/v2.9.0/zephyr/subsys/dfu/img_util/flash_img.c:13:
    C:/ncs/v2.9.0/zephyr/subsys/dfu/img_util/flash_img.c: In function 'flash_img_init':
    C:/ncs/v2.9.0/nrf/include/flash_map_pm.h:47:22: error: 'PM_mcuboot_primary_ID' undeclared (first use in this function); did you mean 'PM__mcuboot_primary_ID'?
    47 | #define PM_ID(label) PM_##label##_ID
    | ^~~
Children
Related