nRF Connect SDK Intermediate – [Lesson 8] – Sysbuild configuration – v2.6.2 – v2.5.2

Multi-Image build (predecessor to Sysbuild)

Important

The multi-image build feature is only relevant to older nRF Connect SDK versions. It was completely deprecated in v3.0.0.

Multi-image builds is an nRF Connect SDK-specific feature for building multiple images. It’s the predecessor to sysbuild. If you use sysbuild, you don’t use multi-image builds.
This section is for users who still use older versions of the nRF Connect SDK and need to learn about multi-image builds.

To explain multi-image builds, first consider how a program for an Nordic SoC works without any framework for building multiple images. In this scenario, you build the bootloader first, then the application. Both build separately, without any knowledge of each other. You must ensure that the bootloader and application agree on their flash storage locations (partition information). After the images build, you write the output file (typically a hex file) from each build to the Nordic SoC separately. The following figure illustrates this process:

Building individual images

You can use this method in the nRF Connect SDK, but it’s not the default. Instead, the nRF Connect SDK uses the Multi-image build system, which handles building multiple images. In multi-image builds, the application builds as the main image, and all other images are added as child images.

The following simplified figure illustrates the multi-image build system:

Simplified illustration of Multi-image build

The following subsections cover the main features of multi-image builds.

Building images in order and choosing the default child image

When you build the main application, the multi-image build system automatically builds all child images in the correct order. For example, if you add CONFIG_BOOTLOADER_MCUBOOT=y to the Zephyr Hello World sample, multi-image builds are enabled. Upcoming exercises examine this in more detail. In the following figure, item (1) shows that a child image is built, as seen in the resulting build log:

Although you can add custom child images to applications, most use cases involve bootloaders and network core images. The nRF Connect SDK includes default samples that you can use as child images. When you enable certain features, the multi-image build system activates and automatically selects an appropriate image based on your main application configuration:

Configuring child images

Child images are often built from samples in the nRF Connect SDK. Because we don’t recommend making changes to the nRF Connect SDK source, how can you configure the child images? Multi-image builds let you configure image-specific variables by overlaying or changing existing child image configurations. You can configure child images in two main ways: using CMake arguments or using a predefined folder structure and configuration files.

To use CMake arguments, you can overlay individual Kconfig options using -D<child_image>_CONFIG_WHATEVER=y (for example, -Dmcuboot_CONFIG_LOG_DEFAULT_LEVEL=3). The following image shows this approach:

You can also overlay files using CMake arguments with -D<child_image>_EXTRA_CONF_FILE or -D<child_image>_DTC_OVERLAY_FILE. To overwrite Kconfig, use -D<child_image>_CONF_FILE.

Alternatively, you can use a folder structure to add files to the project. This is the recommended method and is used in most examples to configure child images. Place these files in a directory named child_image and name them after the child image (typically child_image/mcuboot.conf or child_image/mcuboot/prj.conf). For a complete list, see Multi-image builds: Permanent configuration changes to child images:

The following example shows a simple project with MCUboot overlays:

Generate output files

The multi-image build system also generates output files for programming or DFU of the Nordic SoC. When you use the “Flash” function in the VS Code Extension for a single image build, build/zephyr/zephyr.hex programs to the Nordic SoC. For multi-image builds, build/zephyr/merged.hex is used instead. For a list of output build files generated by multi-image builds, see Multi-image builds: What image files are. For a more comprehensive list of generated output builds in the nRF Connect SDK, see the Build and configuration system documentation. The multi-image build system also generates different output build files for different cores when relevant.

Partitioning

Multi-image builds use Partition Manager for partitioning.

Switch language?

Progress is tracked separately for each language. Switching will continue from your progress in that language or start fresh if you haven't begun.

Your current progress is saved, and you can switch back anytime.

Register an account
Already have an account? Log in
(All fields are required unless specified optional)

  • 8 or more characters
  • Upper and lower case letters
  • At least one number or special character

Forgot your password?
Enter the email associated with your account, and we will send you a link to reset your password.