MCUBoot aborts with sysbuild/mcuboot layout for nRF54L15DK

Hello,

In the latest nRF Connect SDK 3.2. , I've been having a few "sysbuild/mcuboot/boards" folder layout issues with nRF54L15DK / nRF5340DK when using external device FLASH & MCUBoot.

Other existing projects using nRF9150DK and nRF52840 (with 4MB SPI FLASH) boards are successful in builds and application executions.

However, with nRF Connect SDK 3.2.1, the “sysbuild/mcuboot/boards” works for nRF52840 device with external FLASH but not for nRF54L15DK and nRF5340DK.

I think the issue is probably a configuration one but have been unsuccessful trying a few variations.

The issue can be reproduced with the DevAcademy  "Lesson 9 Bootloaders and DFU/FOTA", Exercise 3 – DFU with external flash for nRF54L15DK.

The DevAcademy, l9-exercise 3 "sysbuild" folder layout works fine for nRF54L15DK / nRF5340DK. However, as I typically target the same application for different boards,  I prefer to keep the .conf &.overlay files for the boards in their respective “boards” folder for both the application and MCUBoot. 

The layout shown below works fine for nRF9151, nRF52840, and Thingy53 projects with NCS 3.2.1. The layout doesn't work for nRF5340DK and nRF54L15DK. 

I can build the projects successfully but MCUBoot fails with an "abort()" when starting the bootloader.

*** Booting My Application v2.3.0-dev-0d9411f5dda3 ***
*** Using nRF Connect SDK v3.2.1-d8887f6f32df ***
*** Using Zephyr OS v4.2.99-ec78104f1569 ***
I: Starting bootloader
D: context_boot_go
abort()

I expected the following console output:

*** Booting MCUboot v2.3.0-dev-0d9411f5dda3 ***
*** Using nRF Connect SDK v3.2.1-d8887f6f32df ***
*** Using Zephyr OS v4.2.99-ec78104f1569 ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Image index: 0, Swap type: none
I: Bootloader chainload address offset: 0x17000
I: Image version: v0.0.0
I: Jumping to the first image slot
*** Booting nRF Connect SDK v3.2.1-d8887f6f32df ***
*** Using Zephyr OS v4.2.99-ec78104f1569 ***

The following "sysbuild/mcuboot"  layout for nRF52840 device with external FLASH (spi_xenon_v2)  builds and runs successfully.



The issue can be reproduced with "DevAcademy, l9-exercise 3",  with the following "sysbuild/mcuboot" layouts. I don't see anything obvious that may be incorrect with the MCUBoot configuration.

The folder structure used for the nRF54L15 (and similar for nRF5340DK) and conf/overlay files are listed below. The application fails with "abort()" .

I would appreciate if you could please review and check if this layout builds and runs successfully for you on a nRF54L15DK? Thank you.


"spi" project for nRF54L15 using external FLASH.



spi_nrf54l15_v2/boards/nrf54l15dk_nrf54l15_cpuapp_ns.overlay.overlay:

/* Add external flash to application */
&mx25r64 {
    status = "okay";
};

/ {
    chosen {
        nordic,pm-ext-flash = &mx25r64;
    };
};


spi_nrf54l15_v2/prj.conf:

CONFIG_GPIO=y

# Enable mcumgr DFU in application
CONFIG_MCUMGR=y

# Enable MCUMGR management for both OS and Images
CONFIG_MCUMGR_GRP_OS=y
CONFIG_MCUMGR_GRP_IMG=y

# Configure MCUMGR transport to UART
CONFIG_MCUMGR_TRANSPORT_UART=y

# Dependencies
# Configure dependencies for CONFIG_MCUMGR  
CONFIG_NET_BUF=y
CONFIG_ZCBOR=y
CONFIG_CRC=y

# Configure dependencies for CONFIG_MCUMGR_GRP_IMG  
CONFIG_FLASH=y
CONFIG_IMG_MANAGER=y

# Configure dependencies for CONFIG_IMG_MANAGER  
CONFIG_STREAM_FLASH=y
CONFIG_FLASH_MAP=y

# Configure dependencies for CONFIG_MCUMGR_TRANSPORT_UART 
CONFIG_BASE64=y

# Enable SPI driver for the application
CONFIG_GPIO=y
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_SFDP_DEVICETREE=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

# QSPI drivers are enabled by default for some chips.
# Disable it explicitly to be sure QSPI is disabled.
CONFIG_NORDIC_QSPI_NOR=n


sysbuild/mcuboot/boards/nrf54l15dk_nrf54l15.conf:

# Enable logging for MCUboot
CONFIG_LOG=y

# Turn on a LED so we can see when Serial Recovery mode is active
CONFIG_MCUBOOT_INDICATION_LED=y

# Enable SPI driver for external flash (MCUboot)
CONFIG_GPIO=y
CONFIG_SPI=y
CONFIG_FLASH=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_SFDP_DEVICETREE=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_NORDIC_QSPI_NOR=n 

# required by SPI driver
CONFIG_MULTITHREADING=y

# Increase number of sectors
CONFIG_BOOT_MAX_IMG_SECTORS=512

# nRF54L15 needs some more space for MCUboot.
# so remember to optimize this size in your own project
CONFIG_PM_PARTITION_SIZE_MCUBOOT =0x12000


sysbuild/mcuboot/boards/nrf54l15dk_nrf54l15.overlay:

/ {
  aliases {
        mcuboot-button0 = &button1;
        mcuboot-led0 = &led1;
  };
};

/* Add external flash to MCUboot */
&mx25r64 {
    status = "okay";
};

/ {
    chosen {
        nordic,pm-ext-flash = &mx25r64;
    };
};


sysbuild/mcuboot/prj.conf:

MCUBoot takes the CONFIG_PM_PARTITION_SIZE_MCUBOOT from "sysbuild/mcuboot/prj.conf" file. However, for nRF52840 / nRF9151, I find that MCUBoot can take the MCUBOOT size value from the board ".conf" file, rather than the "sysbuild/prj.conf".

Question - Is the "sysbuild/mcuboot/boards/nrf54l15dk_nrf54l15.conf" effectively merged with the "sysbuild/mcuboot/prj.conf"? If so, shouldn't the board ".conf" take priority?

# Disable Zephyr console
CONFIG_CONSOLE=y

CONFIG_FLASH=y

CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y 
CONFIG_LOG_DEFAULT_LEVEL=0
CONFIG_MCUBOOT_LOG_LEVEL_DBG=y

### Use picolibc to reduce flash usage
CONFIG_PICOLIBC=y

# nRF54L15 needs some more space for MCUboot. 0xF000 is chosen somewhat arbitrarily,
# so remember to optimize this size in your own project
CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x16000


sysbuild.conf:

# MCUboot
SB_CONFIG_BOOTLOADER_MCUBOOT=y
SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
SB_CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APP_DIR}/custom_keys/ed_ci_key.pem"
SB_CONFIG_MCUBOOT_SIGNATURE_USING_KMU=y
SB_CONFIG_BOOT_SIGNATURE_TYPE_ED25519=y
SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KMU_KEYFILE=y

Kind Regards

Parents
  • Hi,

    Output build files

    The final merged configurations for an image can be seen in build/<IMAGE>/zephyr/.config. And for DTS, that would be build/<IMAGE>/zephyr/zephyr.dts. 
    So for mcuboot, that would for example be build/mcuboot/zephyr/.config.

    Firstly, I suggest that you do some testing and compare the .config and zephyr.dts files for mcuboot between the tests. Specifically with and without "sysbuild/mcuboot/".

    Sysbuild overlay vs overwrite

    If you have sysbuild/mcuboot.conf, this will overlay the original MCUboot configuration. Meaning that it will more or less be appended to it.
    If you have sysbuild/mcuboot/prj.conf, this will overwrite the original MCUboot configuration. Meaning that it will replace the original configration.

    So one guess to what goes wrong in your case is that when you use sysbuild/mcuboot/prj.conf, this will overwrite some default configurations needed for external flash.

    You can compare output build files to see the difference, and hopefully find which configurations you are missing.

    Regards,
    Sigurd Hellesvik

  • Hi Siguard,

    Thank you for the quick response. It's much appreciated as always.

    I'll look into your suggestions. I have tried multiple MCUboot configurations for a few days and compared the application and MCUboot ".config" . I'll try again.

    Regarding:

    If you have sysbuild/mcuboot.conf, this will overlay the original MCUboot configuration. Meaning that it will more or less be appended to it.
    If you have sysbuild/mcuboot/prj.conf, this will overwrite the original MCUboot configuration. Meaning that it will replace the original configration.

    So one guess to what goes wrong in your case is that when you use sysbuild/mcuboot/prj.conf, this will overwrite some default configurations needed for external flash.

    Yes, I did compare the default configurations needed for the external FLASH, and had to add "CONFIG_FLASH=y" in "sysbuild/mcuboot/prj.conf" plus extend the MCUBOOT size in the same file for a successful build.

    Does the “sysbuild/mcuboot/boards/<board>.conf” merge with the “sysbuild/mcuboot/prj.conf”? Past usage tends to suggest it.


    Do you mind taking the DevAcademy lesson 9 , exercise 3 (l9_e3) and building & running it for the nRF54L15DK?

    You'll need to restructure the layout as "sysbuild/mcuboot/boards", and change "mcuboot.conf" -> "nrf54l15_nef54l15.conf" and "mcuboot.overlay" -> "nrf54l15_nrf54l15.overlay".

    I think you'll get the same MCUboot abort(). Thank you.


    I've also noticed that the "Asset Tracker Template" app and "nrf_cloud_multi_service", as well as a few others, tend to use "app.overlay" in the "sysbuild/mcuboot" folder.

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

    Should I be using it as well? 


    Best Regards,
    Ravi

  • zpm1066 said:
    Does the “sysbuild/mcuboot/boards/<board>.conf” merge with the “sysbuild/mcuboot/prj.conf”? Past usage tends to suggest it.

    Yes, this board configuration will merge (or more correctly "overlay") sysbuild/mcuboot/prj.conf. (overlay because new configs are appended and existing ones changed)

    zpm1066 said:
    Do you mind taking the DevAcademy lesson 9 , exercise 3 (l9_e3) and building & running it for the nRF54L15DK?

    l9_e3_sol/spi shows this lesson for the nRF54L15DK. See sample.yaml. If you want to build exactly the test we run in our CI, you can do

    west build -p -b nrf54l15dk/nrf54l15/cpuapp . -T ncs_inter.l9.e3.spi_sol.mx

    Alternativley make sure  app_mx.overlay sysbuild/mcuboot_mx.overlay are parts of your build in some other way.

    And then you can try to flash this. Do you still get abort?

    If you do, I will try to reproduce.

    zpm1066 said:
    I've also noticed that the "Asset Tracker Template" app and "nrf_cloud_multi_service", as well as a few others, tend to use "app.overlay" in the "sysbuild/mcuboot" folder.

    This is needed if you do not use the partition manager (SB_CONFIG_PARTITION_MANAGER=n). If not, you should be fine without. 
    However, it is not wrong to have this configuration in your overlays either way.

    The reason is that if you overlay or overwrite MCUboot configuration, this file will no longer be used, and this DTS configuration is needed if you do DTS partitioning.

Reply
  • zpm1066 said:
    Does the “sysbuild/mcuboot/boards/<board>.conf” merge with the “sysbuild/mcuboot/prj.conf”? Past usage tends to suggest it.

    Yes, this board configuration will merge (or more correctly "overlay") sysbuild/mcuboot/prj.conf. (overlay because new configs are appended and existing ones changed)

    zpm1066 said:
    Do you mind taking the DevAcademy lesson 9 , exercise 3 (l9_e3) and building & running it for the nRF54L15DK?

    l9_e3_sol/spi shows this lesson for the nRF54L15DK. See sample.yaml. If you want to build exactly the test we run in our CI, you can do

    west build -p -b nrf54l15dk/nrf54l15/cpuapp . -T ncs_inter.l9.e3.spi_sol.mx

    Alternativley make sure  app_mx.overlay sysbuild/mcuboot_mx.overlay are parts of your build in some other way.

    And then you can try to flash this. Do you still get abort?

    If you do, I will try to reproduce.

    zpm1066 said:
    I've also noticed that the "Asset Tracker Template" app and "nrf_cloud_multi_service", as well as a few others, tend to use "app.overlay" in the "sysbuild/mcuboot" folder.

    This is needed if you do not use the partition manager (SB_CONFIG_PARTITION_MANAGER=n). If not, you should be fine without. 
    However, it is not wrong to have this configuration in your overlays either way.

    The reason is that if you overlay or overwrite MCUboot configuration, this file will no longer be used, and this DTS configuration is needed if you do DTS partitioning.

Children
No Data
Related