Skip to content

MCUBoot is linked to slot0 because overlay is dropped in boilerplate.cmake #15083

@Qbicz

Description

@Qbicz

EDIT: Clarification on request from @SebastianBoe: This issue is the same as mcu-tools/mcuboot#399. However, I suspect the problem to be in Zephyr boilerplate.cmake, not in MCUBoot.
Main problem is that when mcuboot/boot/zephyr/CMakeLists.txt is provided with -DDTC_OVERLAY_FILE from command line, it is not appended to the list of overlayed files, but used instead.
Chain here is mcuboot/boot/zephyr/CMakeLists.txt -> boilerplate.cmake -> dts.cmake.
So far I found that before the line
https://github.com/zephyrproject-rtos/zephyr/blob/master/cmake/app/boilerplate.cmake#L369
DTC_OVERLAY_FILE has all the files it should, and after that it only has the one provided from command line.

Original issue:

Describe the bug
MCUBoot executable should start from 0x000.
However, after NCS umperge d97e9f5 (Zephyr d3bb3cf, MCUBoot ebd05033480cc) when generated/built from zephyr app or nrf app directory, the executable is linked from 0xC000 and cannot be used as bootloader.

To Reproduce
We used to generate MCUBoot build files with the following command:
https://github.com/NordicPlayground/fw-nrfconnect-nrf/blob/master/samples/nrf_desktop/CMakeLists.txt#L131

Configuration is same as in mcuboot/boot/zephyr. The only difference is logging on.
https://github.com/NordicPlayground/fw-nrfconnect-nrf/blob/master/samples/nrf_desktop/configuration/nrf52840_pca20041/mcuboot_ZDebugMCUBoot.conf

However, with after building bootloader the executable starts from 0xC000 as if it was a Zephyr application with MCUBoot support.
Beginning of bootloader hex:

:10C00000485200203DE90000AF0601007DE8000035
:10C010007DE800007DE800007DE800007DE800008C
:10C020007DE800007DE800007DE80000A5E4000058
:10C030007DE800007DE800004DE4000039060100C5
:10C0400015E9000015E9000015E9000015E90000F8
:10C0500015E9000015E9000015E9000015E90000E8

Expected behavior
MCUBoot code should start from 0x000.

Impact
Showstopper.

Environment (please complete the following information):

  • Toolchain (e.g Zephyr SDK 0.10.0, west 0.5.7)
  • Commit d3bb3cf

Metadata

Metadata

Labels

area: MCUBootbugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions