RAM

There is 28 kB of RAM available in the CC2340R2 and 36 kB in the CC2340R5. The various sections of RAM and their associated linker files are as follows.

  • CSTACK: This the system callstack used by the C main function and HWIs.

  • RAM Reset Vector Table: This table holds entries for all supported reset vectors. It is initialized from the flash reset vector table at boot time and is used to plug interrupt table entries at runtime.

For projects where the stack project builds a library:

  • Application and Stack statically allocated data: This includes any initialized and uninitialized variables used by the application or stack. (.data,.bss)

RAM Usage

Like most of the embedded processors, the RAM of the CC23xx is used to store dynamic data (such as the global variables, the threads’ stacks, and the system’s heap). Developers can split the usage of the available RAM according to their needs.

When building the program, the linker will raise an error if the RAM size required by the user exceeds the RAM size specified in the linker command file. In the linker command file, the device’s RAM size is defined by the symbol RAM_SIZE. Executing a project built with the RAM_SIZE value set to a larger value than the RAM actually available on the device may lead to unexpected behaviors.

Note

For the CC23xx, the linker is NOT configured to auto-size the heap as it is the case on other SimpleLink devices. Optimal RAM usage is achieved by allocating all the unused RAM as heap.

Changing the Heap Size

Allocated heap size can be modified in SysConfig through FreeRTOSStack and Heap sizing settings.

../_images/heap_sysconfig_cc23xx.png

Optimal RAM Usage

For optimal RAM usage, it is recommended to allocate all the non-used RAM to the heap. Here is the suggested approach:

  1. Build the project

  2. Assess how much RAM is not allocated using the .map file

  1. Check Unused RAM section at the top of the .map file

  1. Add any Unused RAM to the Heap size (leave a little bit unused for now)

  1. Add through SysConfig: FreeRTOSStack and Heap sizing settings

  1. Rebuild and run the project

  1. After device boots, observe the remaining heap in Runtime Object Viewer. This will indicate the real amount of memory the application can use

Warning

The out-of-the-box projects are configured to leave only a few bytes of RAM non-allocated. This can be misleading when looking at the available RAM in the out-of-the-box projects.

On the unmodified projects, the heap size can be reduced without altering the functioning of the project.