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

Parents
  • Hi,

    For your first project, if you want to add it as a Zephyr module (as you are doing with aci), then ZEPHYR_EXTRA_MODULES must be set in the project CMakeLists.txt. For example:

    cmake_minimum_required(VERSION 3.20.0)
    
    set(ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_LIST_DIR})
    
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(hello_world)
    
    target_sources(app PRIVATE src/main.c)

    For the second project, the board must be specified with ${CONFIG_DOMAIN_CPUNET_BOARD}. You should also be aware that if you provide a relative path without ${CMAKE_CURRENT_LIST_DIR}, then the path will be relative to the build directory. For example, SOURCE_DIR net-src will make the path "hello_world/build/hello-world-net/net-src" in this case.

    add_child_image(
      NAME hello-world-net
      SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/net-src
      DOMAIN cpunet
      BOARD ${CONFIG_DOMAIN_CPUNET_BOARD}
      )

    The child image will also need CMakeLists.txt and prj.conf files.

    Best regards,
    Marte

  • Thanks, I could move on with your help.

    I've created a static Partition Manager config for NET core (pm_static.yml):

    hello-world-net:
    address: 0x1000000
    size: 0x3F000
    region: flash_primary

    otp_partition:
    address: 0x103F000
    size: 0x800
    region: flash_primary

    cfg_partition:
    address: 0x103F800
    size: 0x800
    region: flash_primary

    And this seems to be correct, because the the partitions_cpunet.yml is generated and reflects to my static config. However, compilation fails, because pm_config.h isn't found. How can I fix this?

    Additionally, I think another pm_static.yml shall be defined for the APP core too. I want the 'app' partition occupy the entire APP flash (start from 0x0), because momentarily no MCUboot/b0n is to be used. So I want to burn the generated APP image at 0x0 and run without any boot manager. This stands for NET image too (running without boot manager from 0x1000000). Is it possible at all?

    thanks, regards,

    PS: I've attached the current app + build log, hope it helps.hello_world_dualcore.zip

  • I got things to build but not to work. There are several issues pending issues (like getting MCUboot key pointed to the right file) but the biggest one is that BT spits our runtime error.

    SEGGER J-Link (unknown) V1.0, SN=1050793521
    Process: JLink.exe
    *** Booting nRF Connect SDK v2.5.0 ***
    [00:00:00.020,751] <wrn> bt_hci_core: opcode 0x0c33 status 0x11
    Bluetooth init failed (err -5)

    I put the code into public repo at https://github.com/mjaakkol/multicore Hopefully, I can figure out with help how to make this minimal end-to-end sample. Anybody should feel to comment and add pull requests to get this to work.

  • Hi,

    I saw the same when building the official Bluetooth samples with sysbuild as well, but it seemed to only happen when I tried to flash both domains together with  west flash. Flashing multiple domains built with sysbuild is experimental, so I recommend flashing the domains separately instead, that worked better for me.

    west flash --domain netcore

    west flash --domain multicore

    Best regards,
    Marte

  • Hi,

    The your folder structure is very clear and understandable. I got the same err -5 as yours.

    Did you find the solution?

    best regards

  • 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.

Reply
  • 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.

Children
No Data
Related