nRF5340 multi image build APP + NET core

Hello!

I need to create the following kind of application to nRF5340:

  • APP core: various peripherals (modem, I2C ICs etc) + business logic;
  • NET core:
    • BLE stack (from BLE beacon to more sophisticated solutions);
    • my custom code;

I've spent some time investigating both Zephyr and NRF multicore/child image samples, but none of them covered my needs.

To start with a small leap, I tried to refactor zephyr/samples/hello_world to compile to APP and NET cores with a single command, to have a merged hex and finally to print some text on both cores. I've followed the nrf/samples/nrf5340/multicore sample, but aci dir never gets executed, so the child image is never compiled.

I've attached the modified hello_world. The command was west build -b nrf5340dk_nrf5340_cpuapp

(I've seen in some samples the child_image directory holding config fragments for the child image. It's again not appropriate to me, because I want to be able to specify the config with full path, like it's possible for APP core with the -DCONF=... CMake option).

Please help me implementing a one-command-buildable multi-image hello world for APP+NET ;)

Thanks, regards,

5584.hello_world_multicore.zip


Here's my second attempt based on this page:

doesn't find CPUNET domain, but nrf5340dk_nrf5340_cpuapp board dir features one...

2845.hello_world2.zip

  • I believe Marte's solution should work but I haven't tried it yet as the end of the year hassle kicked in with my customers. I'll plan to get back to this during my Christmas break. I definitely want to find out how this is done proper. Please, try Marte's solution of flashing things separately and report back your results.

  • This is how I'm doing it for a while:

    • a program is compiled for the APP core with MCUboot enabled;
    • another program is compiled for the NET core with MCUboot enabled;
    • so APP and NET images are produced in two steps, both resulting in a merged.hex;
    • two calls to nrfjprog with the aformentioned merged.hex files burn APP and NET core flash areas;
      • naturally, you can reburn only either APP or NET core areas, it's not always mandatory to upgrade both cores;

    This is the best I could find. Using multi-images, child images and other magic was a pain to me, and it didn't work either.

  • I did the test in the flowing step:

    1. download https://github.com/mjaakkol/multicore
    2. in vscode nerf connect extensions, create build configuration for board nrf5340dk_nrf5340_cpuapp, use prj.conf, enable "Use sysbuild"
    3. west flash --recover 
    4. west flash --domain netcore
    5. west flash --domain multicore
    6. connect to VCOM0 and VCOM1
    7. push reset button

    after device reset, I see flowing information. the net core report the same error information "[00:00:00.021,362] <wrn> bt_hci_core: opcode 0x0c33 status 0x11
    Bluetooth init failed (err -5) "as yours.

    Did I missed some step?

  •    and  Thank you for sharing this repo and build steps. They are helpful for my current project. I too found the same Bluetooth init error you described.

    For the record, I built on the command line:

    west build --board nrf5340dk_nrf5340_cpuapp --sysbuild

    I noticed that multicore/netcore/prj.conf includes some config options which are absent from multicore/prj.conf. (I hit the same problem when working with hci_rpmsg as an ordinary child app a few months ago.)

    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    CONFIG_BT_BUF_ACL_RX_SIZE=255
    CONFIG_BT_BUF_ACL_TX_SIZE=251

    After adding those three lines to multicore/prj.conf I see the device shown in the nRF Connect mobile app scan list. Following is the output from the app core console.

    *** Booting nRF Connect SDK v2.5.0 ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Image index: 0, Swap type: none
    I: Bootloader chainload address offset: 0xc000
    *** Booting nRF Connect SDK v2.5.0 ***
    [00:00:00.025,299] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.025,329] <inf> bt_hci_core: HW Variant: nRF53x (0x0003)
    [00:00:00.025,360] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 197.47763 Build 2370639017
    [00:00:00.025,939] <inf> bt_hci_core: No ID address. App must call settings_load()
    [00:00:00.027,069] <inf> bt_hci_core: Identity: D8:E8:22:22:62:A0 (random)
    [00:00:00.027,099] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x2102, manufacturer 0x0059
    [00:00:00.027,130] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x2102
    [00:00:00.029,022] <err> bt_gatt: Failed to save Database Hash (err -2)
    Bluetooth initialized
    Advertising successfully started
  • Thanks for looking it this and sorting it out. I'll add the changes into the code and play around with it a bit more after Christmas.

    I believe per documentation all BT parameters should be duplicated in both projects so test this a bit more.

Related