Apply dts board_variant.overlay specific to mcuboot instead of generic one from board root.

NCS 2.7, nrf52840, sysbuild with mcuboot

2 applications: manufacturing and customer

3 board variants implemented through revisions in boards.yml.  Board revisions enable additional components and configuration which will be used in the application but should not be included into mcuboot.  The two applications use common overlays from the board root directory.

I am having problems because devicetree is taking the board directory overlay instead of the more specific one in sysbuild/mcuboot/boards/.   As I understand it the philosophy is that the most specific file should be used, which in this case would be the sysbuild/mcuboot/boards directory, however devicetree processing uses the overlays from the board directory instead of the mcuboot specific version.  The mcuboot overlay needs to disable or not define the components are that application specific.

Any recommendations for how to structure my directories and builds to avoid duplicating files in many places, which tends to lead to errors when a file is changed in one place but not all other places.

  • Hi,

    For board variants, you need to add the board variant to the filename of the MCUboot overlay to select it instead of the overlay from the board directory in this case. For example, if you are using revision 0.14.0 of the nRF9160 DK, the overlays in sysbuild/mcuboot/boards should be named nrf9160dk_nrf9160_0_14_0.overlay, nrf9160dk_nrf9160_ns_0_14_0.overlay, and nrf9160dk_nrf52840_0_14_0.overlay.

    Best regards,
    Marte

  • Thanks this is helpful, I will give it a try today.

    Is this documented somewhere?  Is this behavior the same as the app/boards directory? 

    It would be nice if these boards directories all had the same set of rules applied with a defined order or preference, I feel like I'm constantly forced to guess at the what will work..

  • Unfortunately that did not work.  

    Loading Zephyr default modules (Zephyr base).
    -- Using NCS Toolchain 2.6.20240605.885759407716 for building. (C:/ncs/toolchains/ce3b5ff664/cmake)
    -- Found Python3: C:/ncs/toolchains/ce3b5ff664/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter 
    -- Cache files will be written to: D:/Flipperz/flipper_workspace2/zephyr/.cache
    -- Zephyr version: 3.6.99 (D:/Flipperz/flipper_workspace2/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: thomas_c, Revision: 6.2.1, qualifiers: nrf52840
    -- Found host-tools: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs/toolchains/ce3b5ff664/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") 
    -- Found BOARD.dts: D:/Flipperz/flipper_workspace2/app.git/boards/ciye/thomas/thomas_c_nrf52840.dts
    -- Found devicetree overlay: D:/Flipperz/flipper_workspace2/app.git/boards/ciye/thomas/thomas_c_6_2_1.overlay
    -- Generated zephyr.dts: D:/Flipperz/flipper_workspace2/app.git/mfg_app/build_thomas_c_6_2_1_x/mfg_app/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: D:/Flipperz/flipper_workspace2/app.git/mfg_app/build_thomas_c_6_2_1_x/mfg_app/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: D:/Flipperz/flipper_workspace2/app.git/mfg_app/build_thomas_c_6_2_1_x/mfg_app/zephyr/dts.cmake

    Despite having the file sysbuild/mcuboot/boards/thomas_c_nrf52840_6_2_1.overlay

    antho@Lenny-Laptop MINGW64 /d/Flipperz/flipper_workspace2/app.git/mfg_app (asterisk/mfg_app)
    $ find ./ -name "thomas_c*.overlay" -print
    ./sysbuild/mcuboot/boards/thomas_c_nrf52840_6_2_1.overlay
    

  • Hi,

    Can you share a minimal project to reproduce this? When I tested revision 0.14.0 of the nRF9160 DK with the Hello World sample, the overlay in sysbuild/mcuboot/boards was correctly picked up and used.

    Best regards,
    Marte

  • It would have been much easier if you could have shared with me your example application folder, but I'll try to get one working with sysbuild and a mcuboot application folder.  I'm a bit unsure about what should go into sysbuild/mcuboot/prj.conf...

Related