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 Children
  • Hi team,
       
          Thanks for your reply.

                We have tried to build our code on nRF SDK v3.0.0 and we follow the steps as per mention in migration guide however still we face some compilation issues, here is the complete build log.

    Kindly review and provide how to resolve the configuration file warnings

    warning: COMMON_LIBC_MALLOC_ARENA_SIZE (defined at
    C:/ncs/v3.0.0/zephyr/soc/mediatek/mt8xxx/Kconfig.defconfig:76, lib/libc\common/Kconfig:57) was
    assigned the value '21144' but got the value ''. Check these unsatisfied dependencies:
    (SOC_FAMILY_MTK || COMMON_LIBC_MALLOC) (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE and/or look
    up COMMON_LIBC_MALLOC_ARENA_SIZE in the menuconfig/guiconfig interface. The Application Development
    Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
    might be helpful too.
    
    
    warning: LOG_BUFFER_SIZE (defined at C:/ncs/v3.0.0/nrf\subsys/net/openthread/Kconfig.defconfig:96,
    subsys/logging\Kconfig.processing:122) was assigned the value '1024' but got the value ''. Check
    these unsatisfied dependencies: (NET_L2_OPENTHREAD || (LOG_MODE_DEFERRED && !LOG_FRONTEND_ONLY &&
    !LOG_MODE_MINIMAL && LOG)) (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_LOG_BUFFER_SIZE and/or look up
    LOG_BUFFER_SIZE in the menuconfig/guiconfig interface. The Application Development Primer, Setting
    Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
    too.
    
    
    warning: MBEDTLS_RSA_C (defined at C:/ncs/v3.0.0/nrf\subsys/net/openthread/Kconfig.defconfig:174,
    C:/ncs/v3.0.0/nrf\subsys\nrf_security\Kconfig.legacy:736) was assigned the value 'y' but got the
    value 'n'. Check these unsatisfied dependencies: (NET_L2_OPENTHREAD || (!MBEDTLS_USE_PSA_CRYPTO &&
    MBEDTLS_LEGACY_CRYPTO_C && NRF_SECURITY)) (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_MBEDTLS_RSA_C and/or look up MBEDTLS_RSA_C
    in the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
    Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.
    
    
    warning: BT_SETTINGS_CCC_LAZY_LOADING (defined at
    C:/ncs/v3.0.0/zephyr/subsys/bluetooth/host/Kconfig:221, subsys/bluetooth\host/Kconfig:221) was
    assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: ((BT_CONN &&
    BT_SETTINGS && BT_HCI_HOST && BT_RPC_STACK) || (BT_CONN && BT_SETTINGS && BT_HCI_HOST && BT_HCI &&
    BT)) (=n). See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_BT_SETTINGS_CCC_LAZY_LOADING
    and/or look up BT_SETTINGS_CCC_LAZY_LOADING in the menuconfig/guiconfig interface. The Application
    Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of
    the manual might be helpful too.
    
    
    warning: BT_PERIPHERAL_PREF_TIMEOUT (defined at
    C:/ncs/v3.0.0/zephyr/subsys/bluetooth/host\Kconfig.gatt:267, subsys/bluetooth\host\Kconfig.gatt:267)
    was assigned the value '75' but got the value ''. Check these unsatisfied dependencies:
    ((BT_GAP_PERIPHERAL_PREF_PARAMS && BT_CONN && BT_HCI_HOST && BT_RPC_STACK) ||
    (BT_GAP_PERIPHERAL_PREF_PARAMS && BT_CONN && BT_HCI_HOST && BT_HCI && BT)) (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_BT_PERIPHERAL_PREF_TIMEOUT and/or look up
    BT_PERIPHERAL_PREF_TIMEOUT in the menuconfig/guiconfig interface. The Application Development
    Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
    might be helpful too.
    
    
    warning: WIFI_READY_LIB (defined at C:/ncs/v3.0.0/nrf\subsys\net\lib\wifi_ready/Kconfig:7) was
    assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies:
    WIFI_NM_WPA_SUPPLICANT (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_WIFI_READY_LIB and/or look up
    WIFI_READY_LIB in the menuconfig/guiconfig interface. The Application Development Primer, Setting
    Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
    too.
    
    
    warning: CC3XX_BACKEND (defined at C:/ncs/v3.0.0/nrf\subsys\nrf_security\Kconfig.legacy:335) was
    assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies:
    MBEDTLS_LEGACY_CRYPTO_C (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_CC3XX_BACKEND and/or look up CC3XX_BACKEND
    in the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
    Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.
    
    
    warning: WDT_DISABLE_AT_BOOT (defined at drivers/watchdog/Kconfig:17) was assigned the value 'y' but
    got the value 'n'. Check these unsatisfied dependencies: HAS_WDT_DISABLE_AT_BOOT (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_WDT_DISABLE_AT_BOOT and/or look up
    WDT_DISABLE_AT_BOOT in the menuconfig/guiconfig interface. The Application Development Primer,
    Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
    helpful too.
    
    
    warning: NRF_WIFI_RPU_RECOVERY (defined at drivers/wifi/nrf_wifi/Kconfig.nrfwifi:659) was assigned
    the value 'y' but got the value 'n'. Check these unsatisfied dependencies: NRF_WIFI_LOW_POWER (=n),
    WIFI_NRF70 (=n). See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_NRF_WIFI_RPU_RECOVERY
    and/or look up NRF_WIFI_RPU_RECOVERY in the menuconfig/guiconfig interface. The Application
    Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of
    the manual might be helpful too.
    
    
    warning: PRINTK (defined at subsys/debug/Kconfig:220) was assigned the value 'n' but got the value
    'y'. See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_PRINTK and/or look up PRINTK in
    the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
    Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.
    
    
    warning: LOG_PROCESS_THREAD_SLEEP_MS (defined at subsys/logging\Kconfig.processing:72) was assigned
    the value '10' but got the value ''. Check these unsatisfied dependencies: LOG_PROCESS_THREAD (=n),
    LOG_MODE_DEFERRED (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_LOG_PROCESS_THREAD_SLEEP_MS and/or look up
    LOG_PROCESS_THREAD_SLEEP_MS in the menuconfig/guiconfig interface. The Application Development
    Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
    might be helpful too.
    
    
    warning: LOG_PROCESS_THREAD_PRIORITY (defined at subsys/logging\Kconfig.processing:112) was assigned
    the value '2' but got the value ''. Check these unsatisfied dependencies:
    LOG_PROCESS_THREAD_CUSTOM_PRIORITY (=n), LOG_PROCESS_THREAD (=n), LOG_MODE_DEFERRED (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_LOG_PROCESS_THREAD_PRIORITY and/or look up
    LOG_PROCESS_THREAD_PRIORITY in the menuconfig/guiconfig interface. The Application Development
    Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
    might be helpful too.
    
    
    warning: NET_CONFIG_MY_IPV6_ADDR (defined at subsys/net/lib/config/Kconfig:83) was assigned the
    value '2001:db8::1' but got the value ''. Check these unsatisfied dependencies: NET_IPV6 (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_NET_CONFIG_MY_IPV6_ADDR and/or look up
    NET_CONFIG_MY_IPV6_ADDR in the menuconfig/guiconfig interface. The Application Development Primer,
    Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
    helpful too.
    
    
    warning: NET_CONFIG_PEER_IPV6_ADDR (defined at subsys/net/lib/config/Kconfig:88) was assigned the
    value '2001:db8::2' but got the value ''. Check these unsatisfied dependencies: NET_IPV6 (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_NET_CONFIG_PEER_IPV6_ADDR and/or look up
    NET_CONFIG_PEER_IPV6_ADDR in the menuconfig/guiconfig interface. The Application Development Primer,
    Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
    helpful too.
    
    
    warning: NET_DHCPV6 (defined at subsys/net/lib/dhcpv6/Kconfig:12) was assigned the value 'y' but got
    the value 'n'. Check these unsatisfied dependencies: NET_IPV6 (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_NET_DHCPV6 and/or look up NET_DHCPV6 in the
    menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
    menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
    and Kconfig - Tips and Best Practices sections of the manual might be helpful too.
    
    
    warning: Deprecated symbol POSIX_CLOCK is enabled.
    
    
    warning: Deprecated symbol POSIX_MQUEUE is enabled.
    
    
    warning: Experimental symbol TFM_EXPERIMENTAL is enabled.
    
    
    warning: Experimental symbol WIFI_CREDENTIALS is enabled.
    
    
    warning: Experimental symbol NET_CONNECTION_MANAGER is enabled.
    
    
    D:/sensors/application/Node_1/prj.conf:45: warning: attempt to assign the value 'y' to the undefined symbol WPA_SUPP
    
    D:/sensors/application/Node_1/prj.conf:142: warning: attempt to assign the value '5' to the undefined symbol WIFI_NRF700X_SCAN_TIMEOUT_S
    
    D:/sensors/application/Node_1/prj.conf:160: warning: attempt to assign the value 'y' to the undefined symbol WIFI_MGMT_EXT
    
    D:/sensors/application/Node_1/prj.conf:271: warning: attempt to assign the value 'n' to the undefined symbol BT_HCI_VS_EXT
    
    D:/sensors/application/Node_1/boards/nrf7002dk_nrf5340_cpuapp.conf:19: warning: attempt to assign the value '16' to the undefined symbol NRF700X_RX_NUM_BUFS
    
    D:/sensors/application/Node_1/boards/nrf7002dk_nrf5340_cpuapp.conf:20: warning: attempt to assign the value '4' to the undefined symbol NRF700X_MAX_TX_AGGREGATION
    
    error: Aborting due to Kconfig warnings
    
    Parsing D:/sensors/application/Node_1/Kconfig
    Loaded configuration 'C:/ncs/v3.0.0/zephyr/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig'
    Merged configuration 'D:/sensors/application/Node_1/prj.conf'
    Merged configuration 'D:/sensors/application/Node_1/boards/nrf7002dk_nrf5340_cpuapp.conf'
    Merged configuration 'D:/sensors/application/Node_1/build/Node_1/zephyr/.config.sysbuild'
    CMake Error at C:/ncs/v3.0.0/zephyr/cmake/modules/kconfig.cmake:396 (message):
      command failed with return code: 1
    Call Stack (most recent call first):
      C:/ncs/v3.0.0/nrf/cmake/modules/kconfig.cmake:36 (include)
      C:/ncs/v3.0.0/zephyr/cmake/modules/zephyr_default.cmake:133 (include)
      C:/ncs/v3.0.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/ncs/v3.0.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
      CMakeLists.txt:13 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    See also "D:/sensors/application/Node_1/build/Node_1/CMakeFiles/CMakeOutput.log".
    See also "D:/sensors/application/Node_1/build/Node_1/CMakeFiles/CMakeError.log".
    FAILED: build.ninja 
    C:\ncs\toolchains\0b393f9e1b\opt\bin\cmake.exe --regenerate-during-build -SD:\sensors\application\Node_1 -BD:\sensors\application\Node_1\build\Node_1
    ninja: error: rebuilding 'build.ninja': subcommand failed
    FAILED: _sysbuild/sysbuild/images/Node_1-prefix/src/Node_1-stamp/Node_1-build D:/sensors/application/Node_1/build/_sysbuild/sysbuild/images/Node_1-prefix/src/Node_1-stamp/Node_1-build 
    cmd.exe /C "cd /D D:\sensors\application\Node_1\build\Node_1 && C:\ncs\toolchains\0b393f9e1b\opt\bin\cmake.exe --build ."
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\0b393f9e1b\opt\bin\cmake.EXE' --build D:/sensors/application/Node_1/build
    .

    Thanks,
    Amirtha N

Related