Zephyr with MCUboot

Last updated on: November 16, 2020

MCUboot - Project Configuration

To enable support for MCUboot in your firmware you need to include the following in the prj.conf

CONFIG_BOOTLOADER_MCUBOOT=y

and optionally

CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

By enabling CONFIG_BOOTLOADER_MCUBOOT, Zephyr will build the merged.hex to include MCUboot (for the case of uploading to a device directly with a programmer) and will make sure that the app_signed.hex is appropriately offset to work with a pre-installed MCUboot (for the case of installing the firmware via a pre-installed MCUboot)

Different MCUboot versions / partitions

If you are building your firmware with nRF Connect SDK v1.3.x or higher and your goal is to upload the app_signed.hex on an Icarus that came with an Asset Tracker Application v1.x.x then you should force the partitions to be compatible with those of earlier Zephyr versions, by doing the following:

  1. Add the following 2 files (partition manager yaml file and MCUboot overlay file) in the project root folder, where the prj.conf resides:
  • pm_static.yml (right click and save file)
  • mcuboot_overlay-rsa.conf (right click and save file)
  1. Insert the following lines into CMakeLists.txt, under the line "cmake_minimum_required..."
set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/pm_static.yml)
list(APPEND mcuboot_OVERLAY_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/mcuboot_overlay-rsa.conf")

The "pm_static.yml" file above sets all the addresses of the partition manager to what they were before the latest Zephyr changes. Please note that this step is not needed if you are using a programmer and upload the MCUboot from the same version of Zephyr as the app.