Multicore Hello World application

The sample demonstrates how to build a Hello World application that runs on multiple cores.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Build target

nRF54H20 DK

PCA10175

nrf54h20dk

nrf54h20dk/nrf54h20/cpuapp

nRF5340 DK

PCA10095

nrf5340dk

nrf5340dk/nrf5340/cpuapp

Overview

The sample demonstrates how to build a multicore Hello World application with the Sysbuild (System build). When building with Zephyr Sysbuild, the build system adds child images based on the options selected in the project’s additional configuration and build files. This sample shows how to inform the build system about dedicated sources for additional images. The sample comes with the following additional files:

  • Kconfig.sysbuild - This file is used to add Sysbuild configuration that is passed to all the images. SB_CONFIG is the prefix for sysbuild’s Kconfig options.

  • sysbuild.cmake - The CMake file adds additional images using the ExternalZephyrProject_Add macro. You can also add the dependencies for the images if required.

Both the application and remote cores use the same main.c that prints the name of the DK on which the application is programmed.

Building and running

This sample can be found under samples/multicore/hello_world in the nRF Connect SDK folder structure.

To build the sample, you need to add the --sysbuild argument to the west build command to build and flash all the cores:

west build -b build_target --sysbuild

This way, code for all the cores will be compiled, and the west flash command will program them.

The west flash command flashes all the cores by default. If you want to flash only one core, you have to add the --domain argument:

west flash --domain hello_world

To build the sample with Visual Studio Code, follow the steps listed on the How to build an application page in the nRF Connect for VS Code extension documentation. See Configuring and building an application for other building scenarios, Programming an application for programming steps, and Testing and optimization for general information about testing and debugging in the nRF Connect SDK.

The remote board needs to be specified using SB_CONFIG_REMOTE_BOARD. As shown below, it is recommended to use configuration setups from sample.yaml using the -T option to build the sample.

nRF5340 DK

You can build the sample for application and network cores as follows:

west build -p -b nrf5340dk/nrf5340/cpuapp -T sample.multicore.hello_world.nrf5340dk_cpuapp_cpunet .
nRF54H20 DK

You can build the sample for application and radio cores as follows:

west build -p -b nrf54h20dk/nrf54h20/cpuapp -T sample.multicore.hello_world.nrf54h20dk_cpuapp_cpurad .

You can build the sample for application and PPR cores as follows:

west build -p -b nrf54h20dk/nrf54h20/cpuapp -T sample.multicore.hello_world.nrf54h20dk_cpuapp_cpuppr .

Note that Nordic PPR snippet (nordic-ppr) is used in the configuration above to automatically launch PPR core from the application core.

An additional configuration setup is provided to execute code directly from MRAM on the PPR core. This configuration uses Nordic boot PPR snippet with execution in place (nordic-ppr-xip) and enables CONFIG_XIP on the PPR core. It can be built as follows:

west build -p -b nrf54h20dk/nrf54h20/cpuapp -T sample.multicore.hello_world.nrf54h20dk_cpuapp_cpuppr_xip .

Testing

After programming the sample to your development kit, complete the following steps to test it:

  1. Connect to the kit with a terminal emulator (for example, nRF Connect Serial Terminal). See Testing and optimization for the required settings and steps.

  2. Reset the kit.

  3. Observe the console output for both cores:

    • For the application core, the output should be as follows:

      *** Booting nRF Connect SDK zephyr-v3.5.0-3517-g9458a1aaf744 ***
      Hello world from nrf5340dk/nrf5340/cpuapp
      Hello world from nrf5340dk/nrf5340/cpuapp
      ...
      
    • For the remote core, the output should be as follows:

      *** Booting nRF Connect SDK zephyr-v3.5.0-3517-g9458a1aaf744 ***
      Hello world from nrf5340dk/nrf5340/cpunet
      Hello world from nrf5340dk/nrf5340/cpunet
      ...