FLASH overflow issue + nrf5340 + DFU external flash

Hi, 

Working with the NRF5340-nrf7002 and the W25Q16RV flash memory in our project. 

  • Initially, I configured an 8MB(W25Q64RV) external flash without issues and tested DFU-FOTA which is working as expected. However, after switching to the 2MB W25Q16RV flash, I’ve encountered a flash memory overflow.
  • When configuring the project to use the 2MB W25Q16RV flash, the linker reports a FLASH region overflowed by 736 bytes:

Here I share build i suspect

CMake Warning at C:/ncs/v2.6.1/nrf/modules/mcuboot/CMakeLists.txt:382 (message):
            ---------------------------------------------------------
          --- WARNING: Using default MCUBoot key, it should not ---
          --- be used for production.                           ---
          ---------------------------------------------------------
      CMake Warning at C:/ncs/v2.6.1/nrf/cmake/partition_manager.cmake:79 (message):
            ---------------------------------------------------------------------
          --- WARNING: Using a bootloader without pm_static.yml.            ---
          --- There are cases where a deployed product can consist of       ---
          --- multiple images, and only a subset of these images can be     ---
          --- upgraded through a firmware update mechanism. In such cases,  ---
          --- the upgradable images must have partitions that are static    ---
          --- and are matching the partition map used by the bootloader     ---
          --- programmed onto the device.                                   ---
          ---------------------------------------------------------------------
        Call Stack (most recent call first):
  C:/ncs/v2.6.1/zephyr/cmake/modules/kernel.cmake:248 (include)
  C:/ncs/v2.6.1/zephyr/cmake/modules/zephyr_default.cmake:138 (include)
  C:/ncs/v2.6.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  C:/ncs/v2.6.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:9 (find_package)
Dropping partition 'nvs_storage' since its size is 0.
Dropping partition 'nonsecure_storage' since it is empty.
CMake Warning at C:/ncs/v2.6.1/nrf/cmake/partition_manager.cmake:601 (message):
  Could not find memory mapped address for XIP.  Generated update hex files
  will not have the correct base address.  Hence they can not be programmed
  directly to the external flash
Call Stack (most recent call first):
  C:/ncs/v2.6.1/zephyr/cmake/modules/kernel.cmake:248 (include)
  C:/ncs/v2.6.1/zephyr/cmake/modules/zephyr_default.cmake:138 (include)
  C:/ncs/v2.6.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  C:/ncs/v2.6.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:9 (find_package)

c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr\zephyr_pre0.elf section `rodata' will not fit in region `FLASH'
c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: region `FLASH' overflowed by 736 bytes

  • The project works fine with an 8MB flash, but not with the 2MB flash, even though the external flash is only used for FOTA image downloads.
  • I need guidance on whether this overflow issue is due to the flash configuration or another underlying cause.
  • Could you please provide insights on the correct configuration for the W25Q16RV flash to resolve the overflow issue?
  • Any recommendations or adjustments to ensure the 2MB flash works without overflow.
  • Hi, 

    You can check the settings for 2MB flash to ensure the settings are correct.  I think the configs should be the same and only the overlay is different. (Maybe my understanding of your flash is wrong.) If everything is correct, maybe the 2MB flash is not big enough for the updated image. Since mcuboot_secondary should be the same size of mcuboot_primary, the size of the application might not be compatible with mcuboot_primary/ mcuboot_secondary. Then, You can try to reduce the size of the application. See Memory footprint optimization

    Here I share build i suspect

    Guess your flash is connected via SPI, so you would see that message. See this post.

    Regards,
    Amanda H.

Related