In this exercise, we will learn how to enable and configure one of the default images provided by the nRF Connect SDK. We will also explore how to confirm the configurations for the various images within an nRF Connect SDK project, as well as the configurations for Sysbuild itself.
We will use MCUboot for this, as it works for most SoC/SiPs. However, the procedure is the same for any other default image, so feel free to try the same for another image.
Open the code base of the exercise by navigating to Create a new application in the nRF Connect for VS Code extension, select Copy a sample, and search for Lesson 8 – Exercise 1. Make sure to use the version directory that matches the SDK version you are using.
1. Build and flash the exercise base to your board.
Build the exercise for whichever board you are using and flash it to the device.
Verify that you get logs that look similar to this:
*** Booting nRF Connect SDK v2.9.0-7787b2649840 ***
*** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
Hello from DevAcademy Intermediate, Lesson 8, Exercise 1
TerminalIf you look at the APPLICATIONS view in nRF Connect for VS Code, you should notice that there is only one image under the build folder: the application image.
The l8_e1
is the application root directory name used in this exercise, and therefore the name of the image is also l8_e1
.
2. Add an extra image (MCUboot) using Sysbuild.
The MCUboot extra image source code and default Sysbuild configuration are provided by the nRF Connect SDK. MCUboot source code is located in <install_path>\<SDK version>\bootloader\mcuboot
. While the Sysbuild configurations for the MCUboot image and the other images are available in <install_path>\<SDK version>\nrf\sysbuild
2.1 Create sysbuild.conf
in the exercise project folder and insert the following comment:
# STEP 2.1 - Add MCUboot
Kconfig2.2 Enable MCUboot in the project by enabling it in sysbuild.conf
:
# STEP 2.1 - Add MCUboot
SB_CONFIG_BOOTLOADER_MCUBOOT=y
Kconfig3. Build and flash the project again.
Make sure to do a Pristine build.
Observe the terminal output from the application.
You should be seeing log output from MCUboot and then from the project after that:
*** Booting MCUboot v2.1.0-dev-12e5ee106034 ***
*** Using nRF Connect SDK v2.9.0-7787b2649840 ***
*** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
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.9.0-7787b2649840 ***
*** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
Hello from DevAcademy Intermediate, Lesson 8, Exercise 1
TerminalIn the APPLICATIONS view of nRF Connect for VS Code, you should now see two images listed under the build folder: the application image and the MCUboot image. Thanks to Sysbuild, both images are managed within a single project. It’s important to note that both images run sequentially on the same CPU core, which is why the same board target appears.
4. Configure the MCUboot image.
Next, we will configure the MCUboot image. To do this, first, create the folder “sysbuild/
” in the exercise project. Then create a file named mcuboot.conf
inside the “sysbuild/
” folder. The project should now look like this:
Add the following comment to mcuboot.conf:
# STEP 4.1 - Disable anything on UART in MCUboot
Kconfig4.1 Disable the serial in MCUboot, so we no longer get any logs over UART
# STEP 4.1 - Disable anything on UART in MCUboot
CONFIG_SERIAL=n
Kconfig5. Build and flash the project again.
Make sure to do a Pristine build since the input Kconfig files have changed.
The UART should now only print the application logs.
*** Booting nRF Connect SDK v2.9.0-7787b2649840 ***
*** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
Hello from DevAcademy Intermediate, Lesson 8, Exercise 1
Terminal6. Let’s now look at how we can verify configurations for the different images and Sysbuild configuration itself. For example, to confirm that the CONFIG_SERIAL
Kconfig symbol was set correctly for the MCUboot image.
You can check MCUboot configuration in the generated build/mcuboot/zephyr/.config
.
You can check the application configuration in the generated build/l8_e1/zephyr/.config
.
You can check Sysbuild configration in the generated build/zephyr/.config
.
Another way to do that is by using the nRF Kconfig GUI. First, you need to select the active context in nRF Connect for VS Code from the APPLICATIONS view, as shown below for MCUboot :
You should notice that the build folder/image name is reflected in the other views in VSCode as highlighted in red in the above screenshot.
Once you select the active context, click on the nRF Kconfig GUI and search for CONFIG_SERIAL. You should see it as unselected. This validates that the Kconfig configration (CONFIG_SERIAL=n
) we set in mcuboot.conf
propagated correctly in the build system and the generated image .config file reflects that.
And also the same is true for DTS in build/<image_name>/zephyr/zephyr.dts
. These files are helpful to check that the hardware overlays that you set in your project were propagated correctly throughout the whole build.