got region `FLASH' overflowed by 259696 bytes error when trying to merge BLE & HTTPS CODE

Hi,

I am using SDK v2.6.1 with the nrf7002dk_nrf5340_cpuapp board.

My HTTPS code works fine, but when I try to merge the configuration files for BLE, ADC, WebSocket, and I2C into the prj.conf file, I encounter the error: FLASH overflowed by 259696.

when we used below parameter then got FLASH overflowed by 259696.

CONFIG_BOOTLOADER_MCUBOOT=y & 
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y 

How can I resolve this issue?

Please find my code and prj.conf file below for your reference.

HTTPWithBle.zip

# Wi-Fi
CONFIG_WIFI=y
CONFIG_WIFI_NRF700X=y
CONFIG_WPA_SUPP=y
# CONFIG_WPA_SUPP_CRYPTO_PSA=y

# Wi-Fi Credentials
CONFIG_WIFI_CREDENTIALS=y
CONFIG_WIFI_CREDENTIALS_STATIC=n

# Networking Management API
CONFIG_NET_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_NET_MGMT_EVENT_INFO=y
CONFIG_NET_MGMT_EVENT_STACK_SIZE=4096
CONFIG_NET_CONNECTION_MANAGER=y
CONFIG_WIFI_MGMT_EXT=y


# Support for shell commands
# CONFIG_SHELL=y
# CONFIG_WIFI_CREDENTIALS_SHELL=y
# CONFIG_SHELL_STACK_SIZE=4400

# Logging
CONFIG_LOG=y

# DK library
CONFIG_DK_LIBRARY=y

# System settings
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_NANO=n

# Networking
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_POSIX_MAX_FDS=16
CONFIG_NET_SOCKETS_POLL_MAX=6

CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=y
CONFIG_NET_TCP=y
CONFIG_NET_DHCPV4=y
CONFIG_DNS_RESOLVER=y


# TLS
# STEP 1.1 - Enable the TLS library and security relevant configurations
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
CONFIG_TLS_CREDENTIALS=y
CONFIG_MBEDTLS_RSA_C=y
CONFIG_MBEDTLS_DHM_C=y 

# STEP 1.2 - Enable support for server name indication (SNI)
CONFIG_MBEDTLS_SSL_SERVER_NAME_INDICATION=y

# Memory
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=153600

CONFIG_NET_TCP_WORKQ_STACK_SIZE=2048
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=4096
CONFIG_NET_BUF_RX_COUNT=16
CONFIG_NET_BUF_TX_COUNT=16
CONFIG_NET_BUF_DATA_SIZE=256
CONFIG_NET_TC_TX_COUNT=0

# HTTP
CONFIG_HTTP_CLIENT=y
# For storing Wi-Fi credentials
CONFIG_WIFI_CREDENTIALS_BACKEND_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y
CONFIG_SETTINGS_NVS=y

# CONFIG_NET_L2_WIFI_SHELL=y

# General
CONFIG_POSIX_CLOCK=y

# Optimize Wi-Fi stack to save some memory

CONFIG_NRF700X_MAX_TX_AGGREGATION=4

# Wi-Fi

CONFIG_WIFI_NRF700X_LOG_LEVEL_ERR=y

# WPA supplicant

CONFIG_WPA_SUPP_LOG_LEVEL_ERR=y

# Zephyr NET Connection Manager connectivity layer
CONFIG_L2_WIFI_CONNECTIVITY=y
# CONFIG_L2_WIFI_CONNECTIVITY_AUTO_DOWN=n
# CONFIG_L2_WIFI_CONNECTIVITY_AUTO_CONNECT=n

# DNS

CONFIG_NET_SOCKETS_DNS_TIMEOUT=30000

# NET sockets

CONFIG_NET_UDP=y
# CONFIG_NET_SOCKETS_OFFLOAD=n

# CONFIG_NET_CONTEXT_SNDTIMEO=y

# TLS networking
CONFIG_NET_SOCKETS_ENABLE_DTLS=n
CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=2


# TLS credentials

# Here is the overlay I used for nrf7002dk_nrf5340_cpuapp

# CONFIG_TLS_CREDENTIALS_BACKEND_VOLATILE=y

# mbedTLS
CONFIG_NRF_SECURITY=y
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=81920
CONFIG_PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY=y
CONFIG_PSA_WANT_RSA_KEY_SIZE_2048=y

CONFIG_MBEDTLS_TLS_LIBRARY=y

CONFIG_PM_SINGLE_IMAGE=y


CONFIG_WEBSOCKET_CLIENT=y
# CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_NEED_IPV4=y

# CONFIG_SPI_NOR=n

# Enable logging system
CONFIG_LOG=y



CONFIG_LOG_MODE_DEFERRED=y

# Enable DK (Development Kit) library for buttons and LEDs
CONFIG_DK_LIBRARY=y

# Enable floating-point support in CBPRINTF
CONFIG_CBPRINTF_FP_SUPPORT=y

# Enable I2C support
CONFIG_I2C=y

# Enable ADC (Analog-to-Digital Converter) support
CONFIG_ADC=y

# Enable Flash memory support
CONFIG_FLASH=y

# Enable Non-Volatile Storage (NVS) support
CONFIG_NVS=y

# Enable flash page layout configuration for NVS
CONFIG_FLASH_PAGE_LAYOUT=y

# Enable debug-level logging for NVS-related operations
CONFIG_NVS_LOG_LEVEL_DBG=y

# Enable Bluetooth Low Energy (BLE) stack
CONFIG_BT=y

# Disable SMP (Security Manager Protocol) to prevent pairing and encryption
CONFIG_BT_SMP=n

# Enable Bluetooth Peripheral role
CONFIG_BT_PERIPHERAL=y

# Set Bluetooth device name
CONFIG_BT_DEVICE_NAME="NKEY blatch"

# Enable Device Information Service (DIS)
CONFIG_BT_DIS=y

# Disable Plug and Play (PNP) feature for DIS
CONFIG_BT_DIS_PNP=n

# Set manufacturer string for the Device Information Service
CONFIG_BT_DIS_MANUF="Nexkey"

# Enable Firmware Revision in Device Information Service
CONFIG_BT_DIS_FW_REV=y

# Set Firmware Revision String for the Device Information Service
CONFIG_BT_DIS_FW_REV_STR="1.0.1"

# Enable Bootloader support for MCUBoot
CONFIG_BOOTLOADER_MCUBOOT=y

# Disable Bluetooth Over-the-Air (OTA) DFU using MCUmgr (if not needed)
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

# Enable immediate log output
CONFIG_LOG_MODE_IMMEDIATE=y

# Allow flash writes during runtime
CONFIG_MPU_ALLOW_FLASH_WRITE=y

# Enable Watchdog timer
CONFIG_WATCHDOG=y
CONFIG_WDT_LOG_LEVEL_DBG=y
CONFIG_WDT_DISABLE_AT_BOOT=n

# Increase stack size for the main thread and system workqueue
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_MAIN_STACK_SIZE=2048

Parents
  • Hi,

    Thank you for reaching out. It seems you’re encountering a common issue with flash memory overflow when enabling multiple features. Here are some suggestions to help you address this:

    1. Decrease Memory Usage

    • Disable unnecessary features: Reduce the size of your application by disabling non-critical features. For example, you can turn off certain debug options or reduce buffer sizes if they're not essential for your application. Disable <
    • Start with a minimal configuration: Begin with a minimal setup and gradually enable features one by one. This approach can help identify which combinations lead to overflow and prioritize essential features.
    • Leverage CONFIG_UPDATEABLE_IMAGE_NUMBER: If using OTA DFU, ensure you’re updating only the required cores. Set CONFIG_UPDATEABLE_IMAGE_NUMBER=2 if both the application and network cores need updates, as highlighted in this forum discussion.
    • Optimize memory allocation: Enable compiler optimizations for size, use smaller C libraries (e.g., CONFIG_MINIMAL_LIBC=y for MCUboot), and consider enabling CONFIG_MCUBOOT_USE_ALL_AVAILABLE_RAM=y in your main application configuration.
    • Wi-Fi memory optimization: Adjust Wi-Fi stack memory usage based on your application’s requirements. Refer to Wi-Fi stack configuration and performance.

    2. Use External Flash Memory

    The nRF7002DK includes external flash memory (mx25r64) that can be utilized for storing parts of your application or as a secondary slot for OTA updates. You can configure this by adding overlay files, as described in this forum post.

    I recommend you to upgrade to NCS 2.8.0. NCS has introduceed numerous improvements and bug fixes since NCS 2.6.1. Check the Release notes for details.

    Let me know if you need further assistance with implementing these suggestions or have additional questions.

    Best regards,

    Charlie

  • Hi,

    we used the FANSTEL module EV-WT02C40C and in this module not external flash available.

    Can you please check my prj.conf file and code and please suggest me where i have require to do change.

    when i add CONFIG_MINIMAL_LIBC=y i have got below error

    /home/chiragbhavsar/NRF_VS_CODE/v2.6.1/nrf/modules/hostap/../../../modules/lib/hostap/src/utils/includes.h:26:10: fatal error: signal.h: No such file or directory
    26 | #include <signal.h>

    when i add  CONFIG_MCUBOOT_USE_ALL_AVAILABLE_RAM=y then i got below warning

    CONFIG_MCUBOOT_USE_ALL_AVAILABLE_RAM was assigned the value y, but got the value n. Missing dependencies:
    ARM_TRUSTZONE_M

    when add CONFIG_UPDATEABLE_IMAGE_NUMBER=2 then i have got below error

    error: static assertion failed: "Missing partitions?"
    87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
    | ^~~~~~~~~~~~~~

Reply
  • Hi,

    we used the FANSTEL module EV-WT02C40C and in this module not external flash available.

    Can you please check my prj.conf file and code and please suggest me where i have require to do change.

    when i add CONFIG_MINIMAL_LIBC=y i have got below error

    /home/chiragbhavsar/NRF_VS_CODE/v2.6.1/nrf/modules/hostap/../../../modules/lib/hostap/src/utils/includes.h:26:10: fatal error: signal.h: No such file or directory
    26 | #include <signal.h>

    when i add  CONFIG_MCUBOOT_USE_ALL_AVAILABLE_RAM=y then i got below warning

    CONFIG_MCUBOOT_USE_ALL_AVAILABLE_RAM was assigned the value y, but got the value n. Missing dependencies:
    ARM_TRUSTZONE_M

    when add CONFIG_UPDATEABLE_IMAGE_NUMBER=2 then i have got below error

    error: static assertion failed: "Missing partitions?"
    87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
    | ^~~~~~~~~~~~~~

Children
No Data
Related