Include an mcuboot-specific overlay in my custom board folder

Hi!

Im creating my own custom board based on the nrf54l15dk board included in zephyr. My board uses both cpuapp and cpuflpr, and has a custom partitioning scheme defined in cpuapp's DTS. It also uses mcuboot.

When writing the board files, the DTS of cpuflpr and cpuapp are kept separate, but mcuboot inherits its DTS from cpuapp. This is practical in many ways, e.g. the partitioning is the same. However, some things must be different. I currently have a file called sysbuild/mcuboot.overlay with the following contents:

/ {
    chosen {
        zephyr,code-partition = &boot_partition;
    };
};

// Avoid errors; Mcuboot is quite particular about memory sections
/delete-node/ &sram_rx;
/delete-node/ &sram_tx;
/delete-node/ &ipc0;

// Mcuboot should not start VPR
&cpuflpr_vpr {
    status = "disabled";
};
 

What I would like to do is to move this file somewhere inside boards/<vendor>/<boardname>/, but all the information I can find about mcuboot-specific overlays says to place it in sysbuild/mcuboot.overlay. Is there a way have mcuboot settings inside my custom board folder?

-Fridtjof

Parents Reply Children
  • Hi Fridtjof,

    Sorry, your question was clear, and I should have read it more carefully. Unlike the FLPR image, the MCUboot image lives in the same domain as the main application, so I do not think it makes sense to create a separate board target for it. I also did not find any examples of this in the SDK tree. Instead, we have MCUboot specific overlays are placed in bootloader/mcuboot/boot/zephyr/boards.

    However, I did some experiments, and it looks like using the pre_dt_board.cmake hook to apply the DT overlay may be an option. You can add this file to your board directory if it is not already present, then add the following lines:

    # Check if the current application is mcuboot by checking its source directory,
    # if so, add the mcuboot overlay file. This is too early in the build process 
    # to check CONFIG_MCUBOOT.
    if(APPLICATION_SOURCE_DIR MATCHES "/mcuboot/boot/zephyr$")
      list(APPEND EXTRA_DTC_OVERLAY_FILE "${CMAKE_CURRENT_LIST_DIR}/mcuboot.overlay")
    endif()

    please keep in mind that this check breaks  if the location of the mcuboot project changes within the SDK tree. It looks like it is too early in the build to gate it on any Kconfig symbols.

    Best regards,

    Vidar

Related