Memory resource requirements

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

Flash

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

120 kB1

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

0x0001F000

RAM

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

0x1348 + Configurable Resources

Minimum: 0x19c0 (6592)

8

APP_RAM_BASE address (minimum required value)

0x20000000 + SoftDevice RAM consumption

Minimum: 0x200019c0

0x20000008

Call stack

By default, the nRF52 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 nRF52 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 application must reserve sufficient space to satisfy both the application and the nRF52 SoftDevice stack memory requirements. The nRF52 SoC has no designated hardware for detecting stack overflow. The application can use the ARM®Cortex®-M4 MPU to implement a mechanism for stack overflow detection.

The SoftDevice does not use the ARM Cortex-M4 Floating-point Unit (FPU) and does not configure any floating-point registers. Table 3 depicts the maximum call stack size that may be consumed by the SoftDevice when not using the FPU.

Note that the SoftDevice uses multiple interrupt levels, as described in detail in Interrupt model and processor availability. If FPU is used by the application, the processor will need to reserve memory in the stack frame for stacking the FPU registers, for each interrupt level used by the SoftDevice. This must be accounted for when configuring the total call stack size. For more information on how the use of multiple interrupt levels impacts the stack size when using the FPU, refer to the ARM Cortex-M4 processor with FPU documentation, Application Note 298.

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

Heap

There is no heap required by nRF52 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 | Subscribe | Updated 2016-12-09