This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Increasing RAM Origin and LENGTH results in overflow with stack

Hi,

I'm trying to add a 3rd Primary Service to my application. I have increased NRF_SDH_BLE_VS_UUID_COUNT to 3 in my sdk_config.h accordingly, and as expected when I run the application the Softdevice asks me to adjust the RAM ORIGIN and LENGTH values, see below:

<warning> nrf_sdh_ble: RAM starts at 0x2000AD68, can be adjusted to 0x2000AD78.
<warning> nrf_sdh_ble: RAM size can be adjusted to 0x5288.
<error> nrf_sdh_ble: sd_ble_enable() returned NRF_ERROR_NO_MEM.
<info> app: Enable BLE stack returned status code: 4
<error> app: Fatal error

However after updating the values in my linker (.ld) file according to the suggested values and trying to build again ARMGCC throws this error:

/usr/local/gcc-arm-none-eabi-4_9-2015q3/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld: region RAM overflowed with stack
collect2: error: ld returned 1 exit status

Does the Softdevice suggest bad values, or what is happening here?

Information:

Board: nRF52832 PCA10040 V1.2.1

SDK: v14.2

Softdevice: S132 version 5.0.0

  • The softdevice has no idea what memory your application requires - it will only tell you how much RAM you need to reserve  in order to use all the enabled functions (connections, attribute size, uuids etc).

    Only the linker knows how much data memory your app requires - and together with softdevice, your app seems to be too big for the NRF53832. Either try to reduce RAM consumtion in your code or use the NRF52840 chip.

  • Hi,

    The nRF52832 have 64kB RAM, with 0x2000AD78(=43 kB) for the SoftDevice, you have 21 kB left for your application.

    If you have increased the NRF_SDH_BLE_GATT_MAX_MTU_SIZE, NRF_SDH_BLE_GAP_EVENT_LENGTH or NRF_SDH_BLE_TOTAL_LINK_COUNT values from the deault, you could try to decrease the values.

    Try these values:

    #define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 23
    
    #define NRF_SDH_BLE_GAP_EVENT_LENGTH 6

Related