Flash overflow in nrf5340-nrf7002


I'm currently working on implementing OpenThread on our custom board based on the nRF5340 along with the nRF7002. While building the project, I'm encountering the following build error:

  "section `rodata' will not fit in region 'FLASH'"
  "region `FLASH' overflowed"
This seems to indicate that the application is exceeding the internal flash limits. I’ve already tried disabling optional OpenThread features, but I still see a large `.rodata` footprint.
Could you please advise on best practices to reduce OpenThread’s memory usage in this configuration, especially while retaining support for the peripheral role?

Additionally, is there an officially supported way to move some of the OpenThread data or code into external flash on the nRF5340? If so, a reference or example would be greatly appreciated.

ERROR LOG
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 167144 bytes

Memory region         Used Size  Region Size  %age Used
           FLASH:      784948 B     892416 B     87.96%
             RAM:      403260 B       440 KB     89.50%
        IDT_LIST:          0 GB        32 KB      0.00%

Parents Reply
  • Is there a specific reason why you are using 2.6.2? In general I would highly recommend using a newer SDK. For example in NCS 3.0 there s up to 25 kB reduction in the RAM footprint of the Wi-Fi stack on nRF5340 for Wi-Fi applications with low throughput requirements. If you need to use 2.6.x for a spesific reason I would at least recommend that you use 2.6.4 as it contain wifi fixes 

    What starting point did you use for your application? Due to the changes that was introduced in NCS 2.7 it will contain breaking changes due to the introduction of Sysbuild and HW model 2. These changes can be found in the migration documentation 

Children
  • When we started development, NCS v2.6.2 was the latest available version, and our application was built and finalized using this version. The project is now in the production stage, so upgrading the SDK at this point could introduce delays due to the need for regression testing and validation. That’s why we are currently staying on v2.6.2.

    However, for future development or if we plan to update the project, we will evaluate compatibility with the latest SDK version. We understand that changes introduced in NCS, so we’ll make sure to review the migration documentation and check for any required updates to APIs or configuration settings.

    As we prepare for potential migration, we would like to clarify the following:

    1. What are the recommended steps for upgrading an existing application from NCS 2.6.2 to the latest version (e.g., NCS 3.x)?

      • Are there structured guidelines or tools to help transition to newer features like Sysbuild and HW model 2?

      • What should we watch out for in terms of API/configuration updates, board definitions, or system changes?

    In the current version (NCS 2.6.2), are there any known methods or best practices to reduce flash usage?

    • We are looking to optimize flash consumption

  • Hi,

    Lavanya_Manohar said:
    What are the recommended steps for upgrading an existing application from NCS 2.6.2 to the latest version (e.g., NCS 3.x)?

    We have migration guides in our documentation. There are guides for migrating from one version to the next, so I recommend going through each. In addition, there are specific guides for migrating from multi-image builds to sysbuild and migrating to the current hardware model. Sysbuild and hw model v2 were introduced in v2.7.0, so these guides are relevant when migrating from v2.6 to v2.7.

    Lavanya_Manohar said:
    In the current version (NCS 2.6.2), are there any known methods or best practices to reduce flash usage?

    We have a memory footprint optimization guide that provides general and protocol-specific tips for optimizing and reducing flash and RAM usage.

    Best regards,
    Marte

Related