Skip to content

Commit 82ee5d0

Browse files
tejlmandnvlsianpu
authored andcommitted
zephyr: fix handling of devicetree overlays in mcuboot
The current specific setting of devicetree overlay files using `set()` has a couple of built-in flaws. It keeps readding the overlay file on each subsequent CMake invocation. The build command (make/ninja), will automatically invoke CMake if there are any changes to files used as configure time dependencies. This can easily be seen by manually re-invoking CMake: ``` # First invocation $ cmake -DBOARD=nrf52840dk_nrf52840 -DDTC_OVERLAY_FILE=custom.dts .. Loading Zephyr default modules (Zephyr workspace). -- Application: /projects/github/ncs/bootloader/mcuboot/boot/zephyr ... -- Found devicetree overlay: custom.dts -- Found devicetree overlay: bootloader/mcuboot/boot/zephyr/dts.overlay # Second invocation $ cmake -DBOARD=nrf52840dk_nrf52840 -DDTC_OVERLAY_FILE=custom.dts .. Loading Zephyr default modules (Zephyr workspace). -- Application: /projects/github/ncs/bootloader/mcuboot/boot/zephyr ... -- Found devicetree overlay: custom.dts -- Found devicetree overlay: mcuboot/boot/zephyr/dts.overlay -- Found devicetree overlay: mcuboot/boot/zephyr/dts.overlay ``` Zephyr has built-in support for application specific overlay config which gets automatically applied when the overlay file is named: `app.overlay`. Therefore rename `dts.overlay` to `app.overlay`. Ref: https://docs.zephyrproject.org/3.2.0/build/dts/howtos.html \ #set-devicetree-overlays This change further allows users of mcuboot to place their mcuboot configuration out-of-tree of the sample by using the `APPLICATION_CONFIG_DIR` setting. Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent 08a716d commit 82ee5d0

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

boot/zephyr/CMakeLists.txt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,6 @@
66

77
cmake_minimum_required(VERSION 3.13.1)
88

9-
# Add a common dts overlay necessary to ensure mcuboot is linked into,
10-
# and fits inside, the boot partition. (If the user specified a
11-
# DTC_OVERLAY_FILE on the CMake command line, we need to append onto
12-
# the list).
13-
if(DTC_OVERLAY_FILE)
14-
set(DTC_OVERLAY_FILE
15-
"${DTC_OVERLAY_FILE} ${CMAKE_CURRENT_LIST_DIR}/dts.overlay"
16-
CACHE STRING "" FORCE
17-
)
18-
else()
19-
set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/dts.overlay)
20-
endif()
21-
229
# Enable Zephyr runner options which request mass erase if so
2310
# configured.
2411
#
File renamed without changes.

boot/zephyr/sample.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,32 @@ tests:
1919
sample.bootloader.mcuboot.usb_cdc_acm_recovery:
2020
tags: bootloader_mcuboot
2121
platform_allow: nrf52840dongle_nrf52840
22-
extra_args: DTC_OVERLAY_FILE=./usb_cdc_acm.overlay
22+
extra_args: DTC_OVERLAY_FILE="./usb_cdc_acm.overlay;app.overlay"
2323
integration_platforms:
2424
- nrf52840dongle_nrf52840
2525
sample.bootloader.mcuboot.usb_cdc_acm_recovery_log:
2626
extra_args: OVERLAY_CONFIG=./usb_cdc_acm_log_recovery.conf
27-
DTC_OVERLAY_FILE=./boards/nrf52840_big.overlay
27+
DTC_OVERLAY_FILE="./boards/nrf52840_big.overlay;app.overlay"
2828
platform_allow: nrf52840dk_nrf52840
2929
integration_platforms:
3030
- nrf52840dk_nrf52840
3131
tags: bootloader_mcuboot
3232
sample.bootloader.mcuboot.single_slot:
3333
extra_args: OVERLAY_CONFIG=./single_slot.conf
34-
DTC_OVERLAY_FILE=./boards/nrf52840_single_slot.overlay
34+
DTC_OVERLAY_FILE="./boards/nrf52840_single_slot.overlay;app.overlay"
3535
platform_allow: nrf52840dk_nrf52840
3636
integration_platforms:
3737
- nrf52840dk_nrf52840
3838
tags: bootloader_mcuboot
3939
sample.bootloader.mcuboot.qspi_nor_slot:
40-
extra_args: DTC_OVERLAY_FILE=./boards/nrf52840dk_qspi_nor_secondary.overlay
40+
extra_args: DTC_OVERLAY_FILE="./boards/nrf52840dk_qspi_nor_secondary.overlay;app.overlay"
4141
OVERLAY_CONFIG="./boards/nrf52840dk_qspi_nor.conf;./boards/nrf52840dk_qspi_secondary_boot.conf"
4242
platform_allow: nrf52840dk_nrf52840
4343
integration_platforms:
4444
- nrf52840dk_nrf52840
4545
tags: bootloader_mcuboot
4646
sample.bootloader.mcuboot.hooks_multi:
47-
extra_args: DTC_OVERLAY_FILE=./boards/nrf52840dk_ram_multi.overlay
47+
extra_args: DTC_OVERLAY_FILE="./boards/nrf52840dk_ram_multi.overlay;app.overlay"
4848
OVERLAY_CONFIG=./boards/nrf52840dk_hooks_sample_overlay.conf
4949
TEST_BOOT_IMAGE_ACCESS_HOOKS=Y
5050
platform_allow: nrf52840dk_nrf52840

0 commit comments

Comments
 (0)