Bug with adding device tree overlay file for a child image in multi-image build

Hi there,

We are currently building with MCUboot as a child image with NRF5340 custom board configuration. Recently I have introduced the new Zephyr's style of enabling drivers, by using DT macros in Kconfig to automatically enable the drivers with "depends on DT_HAS_MY_DRIVER_COMPATIBLE_ENABLED" and "default y" and "select BUS"

Here is our application folder structure :

boards/
child_image
child_image/mcuboot
child_image/mcuboot/boards
drivers/
dts/

CMakeLists.txt
prj.conf
prj_release.conf
zephyr/module.yml


In boards/arm/<board>  folder we have <board>.dts that enables some device tree nodes (accelerometer, ...) on different buses. At this stage the bootloader will use the base device tree file that has these device node enabled, so without other action build system will automatically enable the drivers in Kconfig. This is wanted behavior as some of our own out of tree drivers are included in MCUboot by specifying in zephyr/module.yml where to look for these drivers CMakeLists.txt and Kconfig and our own bindings. We use some of our drivers for custom UI using the exposes MCUBoot hooks. With that we don't need to patch nordic's fork at all, which is pretty nice. But some of these drivers need to be disabled to save flash, as not everything will fit.

So I defined an overlay in child_image/mcuboot/boards so that I can disable some devices for MCUboot using device tree instead of .conf file. This works perfectly fine if I use the default <build_type>  by building the application with prj.conf file.

The problem occurs if I build with prj_release.conf file.

In child_image/mcuboot I have this :

boards/
prj.conf
prj_release.conf

And in boards I added <board>.overlay file, and also <board>.conf and <board_release>.conf for the release build.

For the "debug" build everything gets picked up correctly, but for the release build, everything is picked up as well except the .overlay file. I can clearly see in build/mcuboot/CMakeCache.txt that the overlay file is not picked at all in this configuration.

1. According to documentation : https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/app_dev/multi_image/index.html , it would seem that this overlay file should be picked up regardless of the <build_type> used. Could this be a bug ? Now I'm forced to manually disable the drivers in child_image/mcuboot/boards/<board_release>.conf, but I would prefer not having to do that, as the device tree should be the one that says which drivers should be enabled.

2. Right now we have 2 different builds in child_image/mcuboot folder that match the prj and prj_release.conf in application folder. First I wanted to have a single build using child_image/mcuboot/prj.conf and <board>.conf Kconfig fragments, but build system triggers an error because he says that child_image/mcuboot/prj_release.conf is missing. Is that something normal ? Documentation doesn't specify that child_image/mcuboot/prj_release.conf is mandotary.

Thanks in advance for your help,

Best regards,
Jimmy

Parents
  • Hi,

    1.

    Sounds like a bug or misleading documentation, yes. Have you tried placing <board>.overlay in child_image_/mcuboot/? In addition to or instead of child_image/mcuboot/boards/. If that works, you can also try with an empty <board>.overlay in the mcuboot folder. You can also try adding an empty mcuboot.overlay in the child_image folder.

    2.

    When you get the error you are using the argument -DCONF_FILE=prj_release.conf correct? If so, try adding -Dmcuboot_CONF_FILE=prj.conf

     

Reply
  • Hi,

    1.

    Sounds like a bug or misleading documentation, yes. Have you tried placing <board>.overlay in child_image_/mcuboot/? In addition to or instead of child_image/mcuboot/boards/. If that works, you can also try with an empty <board>.overlay in the mcuboot folder. You can also try adding an empty mcuboot.overlay in the child_image folder.

    2.

    When you get the error you are using the argument -DCONF_FILE=prj_release.conf correct? If so, try adding -Dmcuboot_CONF_FILE=prj.conf

     

Children
  • Hi

    1. So I made a post on Zephyr's "nordic" Discord channel, and one of the nordic developers "tejlmand" told me that this is a bug. The reason is that the multi_image.cmake wants to add the device overlay with the build type included in the name of the overlay file, but in Zephyr's upstream these are ignored and not included  anyway. This needs to be changed so that build type is not included in the overlay file name. I don't know if ticket has been created internally about the issue.

    2. Yes I'm using -DCONF_FILE=prj_release.conf. Thank you for the tip, I will bring that to use when we decide to merge the MCUboot builds into a single build


Related