This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Available RAM for the Application

I am using the nRF51822 chip. The RAM memory is composed of two blocks (0 and 1) of 8kB each, divided into 4 sections : Call Stack, Heap, Application, and SoftDevice. If the block 0 is used by the SoftDevice, so the block 1 is used by the Call Stack, Heap, and Application.

My question is, what is the available amount of memory for the application, knowing that Call Stack is using 1536bytes (in the S110 specification) ? because I can read everywhere that 8kB are available.

Could you please clarify ? Thanks,

  • Hi,

    The call stack is by default set to 2K, which is shared between the softdevice and the application. It is correct as you mentioned that the s110 v.7.0.1 use a maximum of 1536 bytes of the stack. You can modify arm_startup_nrf51.s if you wish to change stack or heap size.

    Heap memory can safely be set to zero as long as you don't use dynamic memory allocation (malloc/free). Note that heap is generally not used in our SDK examples.

    So if you set heap to zero, and keep the default stack, you will have 6K available in the Application region plus the 2K of shared stack.

    image description

    Memory map with s110 enabled, see S110-SDS chapter 10 for more details

    EDIT:Thought I should mention that we just released a new variant of the nRF51 with 32K RAM, in case the 16K was a limiting factor for your application.

  • Thanks Vidar Berg, I see clearly now !

  • Hello Vidar Berg,

    You said that 6 KB of application region and 2KB of shared stack RAM is available then that will be total of 8KB of RAM still if I want to use other 8KB of RAM section as well then how can I enable that section as nRF51822 microcontroller has total of 16KB of RAM ? I am using Keil environment for my project. Thanks in advance!

  • Hello EthanHunt. In Keil go to Options for Target '.....' --> Target and in the bottom right corner you can specify start adress of the RAM. Set it to 0x20000000 and size to 0x4000.

Related