nRF5340: Multicore application

You can use this sample to see how to build an application on the network core as a child image from the sample source files.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Build target

nRF5340 DK

PCA10095

nrf5340dk_nrf5340

nrf5340dk_nrf5340_cpuapp

Overview

The sample demonstrates how to build a multicore application with the add_child_image CMake macro. For general information about multi-image builds, see Multi-image builds. When building any multi-image application, the build system in the nRF Connect SDK adds the child images based on the options selected for the parent image. This sample shows how to inform the build system about dedicated sources for the child image (in the zephyr and aci directories). The sample comes with the following additional files:

  • aci/CMakeLists.txt - This file is used to add the child image and contains the add_child_image macro.

  • zephyr/module.yml - This file contains information about the location of the CMakeLists.txt file that invokes add_child_image that is required for the build system.

  • Kconfig - Custom file that allows to add child image only for the application core. Additionally, it enables options required by the multi-image build.

Both the application and network 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/nrf5340/multicore in the nRF Connect SDK folder structure.

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

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, PuTTY). See How to connect with PuTTY for the required settings.

  2. Reset the kit.

  3. Observe the console output for both cores:

    • For the application core, the output is similar to the following one:

      *** Booting Zephyr OS build v2.7.99-ncs1-2193-gd359a86abf14  ***
      Hello world from nrf5340dk_nrf5340_cpuapp
      
    • For the network core, the output is similar to the following one:

      *** Booting Zephyr OS build v2.7.99-ncs1-2193-gd359a86abf14  ***
      Hello world from nrf5340dk_nrf5340_cpunet