Skip to the content.
« Previous Index Next »

Firmware Coding Standard — Memory & Linker Sections (FreeRTOS)

1) Purpose

Define enforceable rules for memory usage, section placement, DMA/cache safety, and stack/heap policies to ensure determinism and hardware compatibility.


2) Principles


3) Memory Segments & Usage Rules


4) Linker & Section Rules


5) DMA & Cache Safety


6) Stacks


7) Heaps


8) Alignment & Types


9) Memory Protection (if MPU present)


10) Anti-Patterns


11) Review Checklist (Memory)


12) CI/Lint Gates


13) Example Snippets

DMA-safe buffer (non-cacheable)

__attribute__((section(".dma_buf"), aligned(32)))
static uint8_t dma_rx_buf[DMA_RX_LEN];

Static task stack in dedicated section

__attribute__((section(".rtos_stacks")))
static StackType_t task_stack[STACK_SZ];
static StaticTask_t task_tcb;

Linker fragment

.dma_buf (NOLOAD) : ALIGN(32) {
    *(.dma_buf)
} >RAM_D1

« Previous Index Next »