embedded-systemslisted
Install: claude install-skill Claudient/Claudient
# Embedded Systems
## When to activate
Writing firmware for microcontrollers (STM32, ESP32, nRF52, RP2040), designing FreeRTOS task architectures, implementing HAL peripheral drivers, writing interrupt service routines, configuring DMA transfers, optimizing code for memory-constrained devices, or debugging timing-sensitive issues in bare-metal or RTOS environments.
## When NOT to use
Linux-based embedded systems (Raspberry Pi, Yocto) where standard Linux programming applies. High-level IoT connectivity without firmware concerns (use `iot.md`). FPGA HDL design. General C/C++ application development on desktop hardware. Scripting for embedded Linux devices where Python/shell is appropriate.
## Instructions
### Memory Layout
Understanding the linker sections is essential for debugging hard faults and sizing firmware:
```
Flash (read-only, persistent):
.text — compiled machine code
.rodata — read-only constants (const char*, lookup tables)
.data — initial values for initialized globals (copied to RAM at startup)
RAM (read-write, volatile):
.data — initialized globals (copied from flash at startup)
.bss — uninitialized globals (zero-filled at startup)
.heap — grows upward (malloc region)
[gap]
.stack — grows downward from top of RAM
Hard fault on cortex-M → check PSP/MSP for stack overflow into heap
```
Calculate stack usage with FreeRTOS `uxTaskGetStackHighWaterMark()` to find the minimum stack headroom observed since task creation. Set