sysbuild + partition manager + mcuboot + external flash

Using NCS 3.0.0

When placing the app slot 1 in external flash, mcuboot cannot open the flash area.

I am testing this with nrf54L15 + 8 MB SPI flash on the DVK.

This same issue occurs with nrf52840 + 2MB QSPI flash.

static partition config:

1641.pm_static.bl54l15_dvk_nrf54l15_cpuapp.mcuboot.ext_flash.yml.zip

mcuboot debug output:

[00:00:00.003,205] <inf> spi_nor: mx25r6435f@0: SFDP v 1.6 AP ff with 3 PH
[00:00:00.003,214] <inf> spi_nor: PH0: ff00 rev 1.6: 16 DW @ 30
[00:00:00.003,355] <inf> spi_nor: mx25r6435f@0: 8 MiBy flash
[00:00:00.003,365] <dbg> spi_nor: spi_nor_process_bfp: Erase 4096 with 20
[00:00:00.003,371] <dbg> spi_nor: spi_nor_process_bfp: Erase 32768 with 52
[00:00:00.003,378] <dbg> spi_nor: spi_nor_process_bfp: Erase 65536 with d8
[00:00:00.003,385] <dbg> spi_nor: spi_nor_process_bfp: Page size 256 bytes
[00:00:00.003,393] <inf> spi_nor: PH1: ffc2 rev 1.0: 4 DW @ 110
[00:00:00.003,402] <dbg> spi_nor: setup_pages_layout: layout 128 x 65536 By pages
[00:00:00.005,623] <inf> mcuboot: Starting bootloader
[00:00:00.005,659] <err> mcuboot: Failed to open flash area ID 1 (image 0 slot 1): -2, cannot continue

partition manager report:

  bootconf (0x4 - 4B): 
+-------------------------------+
| 0xffd080: bootconf (0x4 - 4B) |
+-------------------------------+

  external_flash (0x800000 - 8192kB): 
+--------------------------------------------------+
+---0x0: mcuboot_secondary (0x16d000 - 1460kB)-----+
| 0x0: mcuboot_secondary_pad (0x800 - 2kB)         |
| 0x800: mcuboot_secondary_app (0x16c800 - 1458kB) |
+--------------------------------------------------+
| 0x16d000: user (0x93000 - 588kB)                 |
| 0x200000: littlefs_storage (0x600000 - 6144kB)   |
| 0x800000: external_flash (0x0 - 0B)              |
+--------------------------------------------------+

  flash_primary (0x17d000 - 1524kB): 
+----------------------------------------------------+
| 0x0: mcuboot (0x12000 - 72kB)                      |
+---0x12000: mcuboot_primary (0x16b000 - 1452kB)-----+
| 0x12000: mcuboot_pad (0x800 - 2kB)                 |
+---0x12800: mcuboot_primary_app (0x16a800 - 1450kB)-+
| 0x12800: app (0x16a800 - 1450kB)                   |
+----------------------------------------------------+

  otp (0x4fc - 1kB): 
+-----------------------------+
| 0xffd500: otp (0x4fc - 1kB) |
+-----------------------------+

  sram_primary (0x40000 - 256kB): 
+--------------------------------------------+
| 0x20000000: sram_primary (0x40000 - 256kB) |
+--------------------------------------------+

Parents
  • I believe I have solved the issue. BOTH of the following need to be set at the sysbuild level:

    SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
    SB_CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y
  • Now I am experiencing a boot loop. Any ideas of where to look? The debugger isn't showing anything useful...

    [00:02:48.723,857] <inf> mcuboot: Starting bootloader
    [00:02:48.724,179] <wrn> mcuboot: Cannot upgrade: not a compatible amount of sectors
    [00:02:48.833,905] <inf> mcuboot: Starting bootloader
    [00:02:48.834,227] <wrn> mcuboot: Cannot upgrade: not a compatible amount of sectors

  • Hi, 

    I am testing this with nrf54L15 + 8 MB SPI flash on the DVK.

    This same issue occurs with nrf52840 + 2MB QSPI flash.

    The settings to use the external flash memory via SPI or QSPI are different. Please take a look at this course https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-9-bootloaders-and-dfu-fota/topic/exercise-3-dfu-with-external-flash/

    This sample zephyr/samples/subsys/mgmt/mcumgr/smp_svr can demonstrate on how to set secondary on the nRF54L15DK external flash. You can build with the  extra_args:
    - OVERLAY_CONFIG="overlay-bt.conf"
    - DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay"
    - mcuboot_CONF_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.conf"
    - mcuboot_EXTRA_DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_ext_flash.overlay"
    - SB_CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y
    - SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y

    -Amanda H.

  • Thank you, that was very helpful!

    1. I fixed my boot loop issue. It had to do with board file issues. I synced my board files with the nrf54l15dk board files in NCS 3.0.0 and it solved the boot loop.

    2. Based on your feedback I was missing: 

    CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
    Now everything looks good:
    [00:00:00.003,449] <inf> spi_nor: mx25r6435f@0: SFDP v 1.6 AP ff with 3 PH
    [00:00:00.010,654] <inf> spi_nor: PH0: ff00 rev 1.6: 16 DW @ 30
    [00:00:00.017,088] <inf> spi_nor: mx25r6435f@0: 8 MiBy flash
    [00:00:00.023,078] <inf> spi_nor: PH1: ffc2 rev 1.0: 4 DW @ 110
    [00:00:00.031,606] <inf> mcuboot: Starting bootloader
    [00:00:00.037,479] <dbg> mcuboot: boot_slots_compatible: Non-optimal sector distribution, slot0 has 354 usable sectors (362 assigned) but slot1 has 362 assigned
    [00:00:00.052,177] <dbg> mcuboot: swap_write_block_size_check: Discrepancy, slot1 expected write block size: 16, actual: 1
    [00:00:00.063,556] <inf> mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    [00:00:00.073,571] <inf> mcuboot: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    [00:00:00.083,531] <inf> mcuboot: Boot source: none
    [00:00:00.089,089] <inf> mcuboot: Image index: 0, Swap type: none
    [00:00:00.194,900] <inf> mcuboot: Bootloader chainload address offset: 0x13000
    [00:00:00.202,447] <inf> mcuboot: Image version: v0.0.0
    [00:00:00.254,553] <inf> main: Canvas Zephyr Firmware v2.1.99+1752088601 [bl54l15_dvk]
Reply
  • Thank you, that was very helpful!

    1. I fixed my boot loop issue. It had to do with board file issues. I synced my board files with the nrf54l15dk board files in NCS 3.0.0 and it solved the boot loop.

    2. Based on your feedback I was missing: 

    CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
    Now everything looks good:
    [00:00:00.003,449] <inf> spi_nor: mx25r6435f@0: SFDP v 1.6 AP ff with 3 PH
    [00:00:00.010,654] <inf> spi_nor: PH0: ff00 rev 1.6: 16 DW @ 30
    [00:00:00.017,088] <inf> spi_nor: mx25r6435f@0: 8 MiBy flash
    [00:00:00.023,078] <inf> spi_nor: PH1: ffc2 rev 1.0: 4 DW @ 110
    [00:00:00.031,606] <inf> mcuboot: Starting bootloader
    [00:00:00.037,479] <dbg> mcuboot: boot_slots_compatible: Non-optimal sector distribution, slot0 has 354 usable sectors (362 assigned) but slot1 has 362 assigned
    [00:00:00.052,177] <dbg> mcuboot: swap_write_block_size_check: Discrepancy, slot1 expected write block size: 16, actual: 1
    [00:00:00.063,556] <inf> mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    [00:00:00.073,571] <inf> mcuboot: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    [00:00:00.083,531] <inf> mcuboot: Boot source: none
    [00:00:00.089,089] <inf> mcuboot: Image index: 0, Swap type: none
    [00:00:00.194,900] <inf> mcuboot: Bootloader chainload address offset: 0x13000
    [00:00:00.202,447] <inf> mcuboot: Image version: v0.0.0
    [00:00:00.254,553] <inf> main: Canvas Zephyr Firmware v2.1.99+1752088601 [bl54l15_dvk]
Children
Related