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

nRF9160: Assigning variables to RAM slots

Hi,

In one module of an application I would like to statically declare a large buffer in SRAM:  static uint8_t largeBuffer[65536];

The application fails to link with the following error:

/opt/toolchains/zephyr-sdk-0.11.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/9.2.0/../../../../arm-zephyr-eabi/bin/ld: region `SRAM' overflowed by 62972 bytes

For the nRF9160, is there a reference for how to assign variables to SRAM slots, allowing modules to manage their own encapsulated static data?

Thanks,

Paul

Parents Reply
  • Hi Håkon,

    The latest version of the BSD lib (0.7.3) of NCS (1.3.0) seems to support user application specified location and size for bsd library memory:

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.3.0/nrfxlib/bsdlib/doc/api.html#_CPPv417bsd_init_params_t

    I am not sure yet how to approach this, but my initial thoughts are to reduce the secure region size of 64kB. What is the reason for such a large memory allocation to the SPM? My understanding is the SPM configures peripherals and memory regions for secure and non-secure then launches the non-secure application. Are there any secure services/functions that are continuing to run or be callable? If so, does bsd lib depend on them?

    If the secure region of RAM can be reduced to something minimal or zero, then allocate 256kB to the non-secure user application and set up a static array of 49,184 bytes and pass that to bsd_init function. Then the linker can figure out how to organize the RAM for another 64kB array for this particular application's required buffer.

    -Jonathan

Children
Related