Memory resource requirements

The tables below show the memory resource requirements both when the S130 SoftDevice is enabled and disabled.

Flash

Table 1. S130 Memory resource requirements for flash
Flash Value
Required by the SoftDevice

104 kB1

Required by the MBR 4 kB
APP_CODE_BASE address (absolute value)

0x0001B000

RAM

Table 2. S130 Memory resource requirements for RAM
RAM S130 Enabled S130 Disabled
Required by the SoftDevice (in bytes)

0x1288 + Configurable Resources

Minimum: 0x13C8 (5064)

8

APP_RAM_BASE address (minimum required value)

0x20000000 + SoftDevice RAM consumption

Minimum: 0x200013C8

0x20000008

Call stack

By default, the nRF51 SoC will have a shared call stack with both application stack frames and SoftDevice stack frames, managed by the main stack pointer (MSP).

The call stack configuration is done by the application, and the MSP gets initialized on reset to the address specified by the application vector table entry 0. The application may, in its reset vector, configure the CPU to use the process stack pointer (PSP) in thread mode. This configuration is optional but may be required by an operating system (OS); for example, to isolate application threads and OS context memory. The application programmer must be aware that the SoftDevice will use the MSP as it is always executed in exception mode.

Important: It is customary, but not required, to let the stack run downwards from the upper limit of the RAM Region.

With each release of an nRF51 SoftDevice, its maximum (worst case) call stack requirement may be updated. The SoftDevice uses the call stack when SoftDevice interrupt handlers execute. These are asynchronous to the application, so the application programmer must reserve call stack for the application in addition to the call stack requirement by the SoftDevice.

The nRF51 SoC has no hardware for detecting stack overflow, and the application is responsible for leaving enough space both for the application itself and the nRF51 SoftDevice stack requirements.

Table 3 depicts the maximum call stack size that may be consumed by the SoftDevice. The application call stack memory usage must be added to the SoftDevice call stack size, in order to determine the total call stack size, and configure it in the user application.

Table 3. S130 Memory resource requirements for call stack
Call stack S130 Enabled S130 Disabled
Maximum usage 1536 bytes (0x600) 0 bytes

Heap

There is no heap required by nRF51 SoftDevices. The application is free to allocate and use a heap without disrupting the SoftDevice functionality.

1 1 kB = 1024 bytes

Documentation feedback | Developer Zone | Updated 2016-04-08