FreeRTOS
Purpose
Guide agents through FreeRTOS application development: task creation and priorities, inter-task communication with queues and semaphores, stack overflow detection, configASSERT, and FreeRTOS-aware debugging with GDB and OpenOCD.
Triggers
- "How do I create a FreeRTOS task?"
- "How do I pass data between FreeRTOS tasks?"
- "My FreeRTOS task is crashing — how do I detect stack overflow?"
- "How do I use FreeRTOS mutexes?"
- "How do I debug FreeRTOS tasks with GDB?"
- "How do I configure FreeRTOSConfig.h?"
Workflow
1. Task creation and priorities
Priority guidelines:
tskIDLE_PRIORITY(0) — idle task, never block here- ISR-deferred tasks — highest priority to service interrupts quickly
- Avoid priorities above
configMAX_PRIORITIES - 1
2. Queues — inter-task data passing
From ISR: use xQueueSendFromISR() and pass &xHigherPriorityTaskWoken.
3. Semaphores and mutexes
Use mutex (not binary semaphore) for shared resources to get priority inheritance.
4. Stack overflow detection
Check watermarks at runtime:
5. Essential FreeRTOSConfig.h settings
6. GDB debugging with OpenOCD
7. FreeRTOS v11 API updates
FreeRTOS v11 (2024+) extends task notifications and stream buffers:
Check FreeRTOS.h tskKERNEL_VERSION_NUMBER at compile time for API availability.
8. ARM TrustZone integration
Secure/non-secure world split on Cortex-M33/M55:
Requires TrustZone-enabled MCU, secure firmware partition, and NSC linker section placement.
9. FreeRTOS+TCP basics
Configure buffer counts and TCP/IP options in FreeRTOSIPConfig.h (e.g., ipconfigUSE_TCP, ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS). Pairs with an Ethernet MAC driver and FreeRTOS+TCP buffer management.
10. MPU region configuration
Define separate RAM regions for read-only code/data, privileged peripherals, and task-private stacks.
For OpenOCD setup details, see skills/embedded/openocd-jtag.
For FreeRTOSConfig.h reference, see references/freertos-config.md [blocked].
Related skills
- Use
skills/embedded/openocd-jtagfor GDB/OpenOCD remote debugging setup - Use
skills/embedded/linker-scriptsfor placing FreeRTOS heap in specific RAM regions - Use
skills/debuggers/gdbfor general GDB session management - Use
skills/embedded/zephyrfor an alternative RTOS with built-in device management


