Code Placement#

Code Placement API.

Provides support for executing code from RAM rather than flash memory. Note

  • Inlined functions are placed wherever the calling function resides.


Use Cases#

Consider placing code in RAM when:

  • The function is performance-critical and called frequently

  • The function must execute with minimal latency

  • The function is called during flash operations (erase/write)

  • Deterministic timing is required (eliminates flash wait states)


Linker Requirements#

The linker script must define the appropriate RAM section "text_application_ram" for code placement.

The "text_application_ram" section is pre-configured in Silicon Labs linker scripts, but custom linker scripts must include the "text_application_ram" section.


Usage#

In your .h file:

#include "sl_code_classification.h"

SL_CODE_RAM
void MyPrint(const char* string);

Macros#

#define
SL_CODE_RAM __attribute__((section("text_application_ram")))

Prepend a function definition with this macro to place it in RAM.