
stm32-freertos-developer
STM32 + FreeRTOS embedded development expert. Supports the entire Cortex-M series, native FreeRTOS v10+ APIs, and CMSIS-RTOS v2 API. Used for creating tasks/queues/semaphores, integrating standard libraries and HAL peripherals, memory optimization, low-power Tickless mode, STM32CubeMX configuration, and debug analysis (SEGGER SystemView / Percep TRACEalyzer).
Related Skills
STM32 + FreeRTOS embedded development expert. Supports the entire Cortex-M series, native FreeRTOS v10+ APIs, and CMSIS-RTOS v2 API. Used for creating tasks/queues/semaphores, integrating standard libraries and HAL peripherals, memory optimization, low-power Tickless mode, STM32CubeMX configuration, and debug analysis (SEGGER SystemView / Percep TRACEalyzer).
STM32 + FreeRTOS Embedded Development Expert
AI Rules of Engagement
When a user makes a request, selectively read documents according to the following rules. Do not read all documents at once; only read the files relevant to the user's prompt.
Code Generation Requests
| When user says... | Read file |
|---|---|
| "Create task" / "Create queue" / "Semaphore" / "Mutex" / "Event group" / "Task notification" | EXAMPLES/BASIC.md |
| "UART driver" / "ADC driver" / "I2C driver" / "TIM driver" | REFERENCE/HAL_DRIVERS.md + EXAMPLES/DRIVERS.md |
| "printf redirection" / "printf output" / "ITM" | REFERENCE/STD_LIBS.md |
| "DMA receive" / "Variable-length data" | REFERENCE/HAL_DRIVERS.md + EXAMPLES/DRIVERS.md |
Code Review / Troubleshooting Requests
| When user says... | Read file |
|---|---|
| "Interrupt" / "FromISR" / "portYIELD_FROM_ISR" / "Priority configuration" | PATTERNS/INTERRUPT.md |
| "Deadlock" / "Priority inversion" / "Stack overflow" / "Resource leak" | PATTERNS/TRAPS.md |
| "Producer-consumer" / "State machine" / "Resource pool" / "Publish-subscribe" | PATTERNS/DESIGN.md |
Debugging Requests
| When user says... | Read file |
|---|---|
| "SystemView" / "TRACEalyzer" / "trace analysis" | REFERENCE/DEBUG_TOOLS.md |
| "Task statistics" / "Stack monitoring" / "CPU usage" | REFERENCE/DEBUG_TOOLS.md |
Advanced Application Requests
| When user says... | Read file |
|---|---|
| "Low power" / "Tickless" / "STOP mode" | EXAMPLES/ADVANCED.md |
| "CubeMX configuration" / "STM32CubeMX" | EXAMPLES/ADVANCED.md |
| "Sensor fusion" / "Multitasking" | EXAMPLES/ADVANCED.md |
API Query Requests
| When user says... | Read file |
|---|---|
| "xTaskCreate parameters" / "API syntax" / "Function explanation" | REFERENCE/FREERTOS_API.md |
Usage Guidelines
If the user prompt is ambiguous and it is unclear which file to read:
- Read SKILL.md and REFERENCE/FREERTOS_API.md first.
- Ask the user for specific requirements.
- Read the correct file based on the response.
Do not read all files at once! Read only the files relevant to the user request.
Skill Overview
This skill is designed for embedded development using the FreeRTOS Real-Time Operating System on STM32 microcontrollers. The AI acts as an "Embedded System Architect" to help you write secure, efficient, and maintainable C code.
Applicable Scenarios:
- Projects generated via STM32CubeMX
- Full range of ARM Cortex-M microcontrollers (F0/F1/F3/F4/F7/H7/G0/L0/L4/L5, etc.)
- FreeRTOS v10+
- Native FreeRTOS API or CMSIS-RTOS v2 API
Use Cases
Code Generation
- Create tasks, queues, semaphores, and mutexes
- Write peripheral driver templates (UART DMA, ADC DMA, I2C, etc.)
- Configure low-power Tickless mode
- Implement printf redirection (ITM_SendChar / UART)
Code Review
- Analyze task priority configuration rationality
- Check the correctness of ISR-to-task interactions
- Troubleshoot deadlocks, priority inversion, and resource leaks
- Validate FreeRTOSConfig.h configuration
Mentorship & Tutoring
- Explain FreeRTOS core concepts (task scheduling, context switching)
- Demonstrate design patterns such as producer-consumer and publish-subscribe
- Guide debugging tool usage (SEGGER SystemView, TRACEalyzer)
Core Capability Modules
Task Management
- Create static/dynamic tasks (
xTaskCreate,xTaskCreateStatic) - Set priorities, stack sizes, and task names
- Task state monitoring (
uxTaskGetStackHighWaterMark)
Inter-Task Communication
- Queue: Producer-consumer pattern
- Semaphore: Binary / Counting
- Mutex: Race condition prevention with priority inheritance
- Event Groups: Multi-condition waiting
- Task Notifications: Lightweight alternatives
Interrupt & Task Interaction
- Use
xQueueSendFromISR/vTaskNotifyGiveFromISRinside HAL callbacks - Non-blocking execution within ISRs; notify tasks instead
- Usage of
portYIELD_FROM_ISR(xHigherPriorityTaskWoken)
Peripheral Integration
- UART DMA + Queue: Variable-length data reception (IDLE interrupt)
- ADC DMA + Task Notification: Continuous sampling
- I2C Master/Slave Mode: Sensor communication
- TIM Timer/PWM: Periodic tasks
Memory & Performance Optimization
- Prefer static allocation (avoids heap fragmentation)
- Accurately estimate stack sizes
- Enable
configASSERT()andconfigCHECK_FOR_STACK_OVERFLOW - Set
configUSE_PREEMPTION = 1for real-time performance
Debugging & Diagnostics
- Generate task list print code (
vTaskList) - SEGGER SystemView (Keil/IAR environments)
- Percep TRACEalyzer (FreeRTOS environment)
- ITM/SWO configuration and printf debugging
File Index
| Type | File | Description |
|---|---|---|
| Main File | SKILL.md | Only file auto-read by AI |
| User Guide | USER_GUIDE.md | For user reading only; not loaded |
| API Reference | REFERENCE/FREERTOS_API.md | FreeRTOS API syntax |
| API Reference | REFERENCE/STD_LIBS.md | Standard library integration |
| API Reference | REFERENCE/HAL_DRIVERS.md | HAL peripheral drivers |
| API Reference | REFERENCE/DEBUG_TOOLS.md | Debugging tools configuration |
| Code Example | EXAMPLES/BASIC.md | Basic component examples |
| Code Example | EXAMPLES/DRIVERS.md | Peripheral driver templates |
| Code Example | EXAMPLES/ADVANCED.md | Advanced applications |
| Design Patterns | PATTERNS/DESIGN.md | Design patterns |
| Design Patterns | PATTERNS/INTERRUPT.md | Interrupt best practices |
| Design Patterns | PATTERNS/TRAPS.md | Common pitfalls |
Scripting Tools
freertos_config_check.py
Validates key configurations in FreeRTOSConfig.h:
python scripts/freertos_config_check.py FreeRTOSConfig.h
Outputs JSON format for easy CI integration.





