MCUboot spi-nor external flash

We have developed a custom board with an external SPI flash, which I have tested and it works. 

We want to use OTA over BLE, so we have added MCUboot to the project, which should use the external flash.

We are using SDK toolchain v2.6.1

In the prj.conf file I have enabled SPI external flash and MCU boot using:

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_SPI=y
CONFIG_SPI_NOR=y

CONFIG_BOOTLOADER_MCUBOOT=y

I have created a folder:

The files are added here.

When I try to build i fails with the error:

zephyr/drivers/flash/libdrivers__flash.a(spi_nor.c.obj):(.rodata.spi_nor_config_0+0x0): undefined reference to `__device_dts_ord_99'

Which I think refers to the spi-nor driver, but I'm stuck here, and cannot figure out why this happens. ?

4760.mcuboot.overlay

6835.mcuboot.conf

  • Thank you.
    I almost got it working now... :-)
    But when I updated the fw using the NRFconnect App, I cannot update again, it seems that it complaint about there is not enough room for the image.
    But it should erase the external flash, not try to fit another image into that region. ?

    I get the error:
    I: Image index: 0, Swap type: perm
    E: Image upload inspect failed: 9

  • Hi, 

    Did you enable CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY in the prj.conf?

    Could you provide the memory layout by executing "ninja partition_manager_report" under the build folder?

    -Amanda H.

  • Yes, I did put that line in the prj.conj for the main project, but not for the child_image project.

  • I suspect your external flash setting is not correct. You can check the memory layout by executing "ninja partition_manager_report" under the build folder or generate a Memory report   and provide the memory layout from the Partitions tab. 

    You should see the mcuboot_secondary located on the external memory or at least the external memory.

  • external_flash (0x80000 - 512kB):
    +------------------------------------------+
    | 0x0: mcuboot_secondary (0x6de00 - 439kB) |
    | 0x6de00: external_flash (0x12200 - 72kB) |
    +------------------------------------------+

    flash_primary (0x80000 - 512kB):
    +--------------------------------------------------+
    | 0x0: mcuboot (0x10000 - 64kB) |
    +---0x10000: mcuboot_primary (0x6e000 - 440kB)-----+
    | 0x10000: mcuboot_pad (0x200 - 512B) |
    +---0x10200: mcuboot_primary_app (0x6de00 - 439kB)-+
    | 0x10200: app (0x6be00 - 431kB) |
    | 0x7c000: settings_storage (0x2000 - 8kB) |
    +--------------------------------------------------+
    | 0x7e000: userstorage (0x2000 - 8kB) |
    +--------------------------------------------------+

    sram_primary (0x10000 - 64kB):
    +-------------------------------------------+
    | 0x20000000: sram_primary (0x10000 - 64kB) |
    +-------------------------------------------+

Related