nRF5340: Network core bootloader

The network core bootloader sample, also called B0n, is an immutable first-stage bootloader that can update the application firmware on the network core of the nRF5340 System on Chip (SoC).

Overview

The network core bootloader sample protects the flash memory areas allocated to both itself and the application running on the network core.

You must use this sample as a child image of a multi-image build, where MCUboot is enabled and there is a network core application. MCUboot verifies and shares with the network core bootloader any new network core application image received through a device firmware update (DFU) transport layer, like a serial or a Bluetooth® LE connection. For this reason, without MCUboot, this sample does nothing else but directly launches the application.

During the boot process, the network core bootloader sample and MCUboot interact as follows:

  1. When MCUboot receives a new network core application image, it writes the configuration for the network core bootloader to the shared SRAM.

    The configuration includes an update instruction and both the SHA and the data of the image.

  2. The network core bootloader locks the flash memory areas containing itself and its configuration.

    Locking is done using the ACL peripheral. For details on locking, see the Hardware flash write protection driver.

  3. It performs any pending network core firmware update.

    The network core bootloader calls the Peripheral CPU DFU (PCD) library to inspect the SRAM region shared with the application core:

    1. If MCUboot has written an update instruction, the network core bootloader copies the specified data range to the application partition on the network core.

    2. Once the copy is done, the network core bootloader compares the SHA of the data in the application partition against the SHA specified in the shared SRAM.

    3. It then communicates the result of the comparison to MCUboot using the shared SRAM.

  4. It then locks the flash memory areas containing the network core application.

    Locking is done using the ACL peripheral. For details on locking, see the Hardware flash write protection driver.

  5. It boots the application on the network core.

    After possibly performing a firmware update, and enabling flash memory protection, the network core bootloader uninitializes all peripherals that it used and boots the application.

Requirements

The sample supports the following development kit:

Hardware platforms

PCA

Board name

Build target

nRF5340 DK

PCA10095

nrf5340dk_nrf5340

nrf5340dk_nrf5340_cpunet

Building and running

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

Follow the steps below to include the sample as a child image in a multi-image build that contains a network core application:

  1. Add MCUboot to the build by enabling the CONFIG_BOOTLOADER_MCUBOOT option in the application that runs on the application core. When doing so, the build system includes the sample in the build by automatically enabling the CONFIG_SECURE_BOOT option for the application that runs on the network core.

  2. Enable the Peripheral CPU DFU (PCD) library for MCUboot by setting the CONFIG_PCD_APP option when building its image.

The build system generates a new set of firmware update files. These files match the ones described in Using MCUboot in nRF Connect SDK, except that they contain the network core application firmware and are prefixed with net_core_.

See Configuring your application for information on how to enable the required configuration options. Then follow the instructions in Building and programming a sample to build and program the images for the network and application core.

Note

To easily try out the network core bootloader sample, you can use the Bluetooth: Peripheral UART sample as the basis for the multi-image build. This sample automatically includes the network core sample Bluetooth: HCI RPMsg when built for the nRF5340 DK. You can then apply the options mentioned above to include the network core bootloader sample with MCUboot.

Testing

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

  1. Connect to the kit that runs this sample with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.

    Note

    The nRF5340 DK has multiple UART instances, so the correct port must be identified. See Getting logging output for additional details.

  2. Reset the kit.

  3. Observe that the output includes the following line:

    Done updating network core
    

Dependencies

This sample uses the following nRF Connect SDK libraries:

The sample also uses drivers from nrfx.