Table of Contents
- 1.1 RTOS Concepts vs Bare-Metal Development
- 1.1.1 Characteristics of Bare-Metal Development
- 1.1.2 Core Concepts of RTOS
- 1.1.3 Comparative Summary
- 1.2 FreeRTOS Architecture and Open Source License
- 1.2.1 System Architecture
- 1.2.2 Open Source License Analysis
- 1.2.3 Typical Application Scenarios
- Experimental Suggestions

1.1 RTOS Concepts vs Bare-Metal Development
1.1.1 Characteristics of Bare-Metal Development
// Example of typical bare-metal code structure
void main() {
while(1) {
task1(); // Task 1
task2(); // Task 2
task3(); // Task 3
}
}
- Polling Architecture: Sequential execution of all tasks
- Simplicity: No scheduling overhead, direct hardware control
- Limitations:
- Real-time latency (high-priority tasks cannot preempt)
- Task blocking leads to system stagnation
- Resource utilization issues (CPU often in busy-wait state)
1.1.2 Core Concepts of RTOS
// Example of FreeRTOS task creation
xTaskCreate(taskFunction, "Task", configMINIMAL_STACK_SIZE, NULL, 1, NULL);
- Task Scheduling:
- Priority preemptive scheduling
- Time-slicing (for same priority)
- System Services:
- Inter-task communication (queues/semaphores)
- Memory management
- Timer services
- Real-time Guarantees:
- Deterministic task response times
- Worst-case execution time (WCET) is predictable
1.1.3 Comparative Summary
| Feature | Bare-Metal System | RTOS System |
|---|---|---|
| Response Speed | Depends on code order | µs-level task switching |
| Multi-tasking | Requires manual polling | Native support |
| Resource Usage | Minimal (1-2KB RAM) | Typically requires 4-10KB RAM |
| Development Complexity | Simple | Requires understanding of RTOS concepts |
| Application Scenarios | Simple control logic | Complex multi-tasking systems |
1.2 FreeRTOS Architecture and Open Source License
1.2.1 System Architecture
FreeRTOS Core Components
├── Task Scheduler
│ ├── Priority Preemptive
│ └── Cooperative (optional)
├── Memory Management
│ ├── heap_1~5
│ └── User-defined
├── Communication Mechanisms
│ ├── Queue
│ ├── Semaphore
│ └── Mutex
└── Hardware Abstraction Layer
├── Port Layer
└── Clock Management
1.2.2 Open Source License Analysis
- MIT License Core Features:
1. Allows commercial use 2. Modifications must retain copyright notice 3. No warranty liability 4. Prohibition on using the author's name for promotion - Commercial Application Considerations:
- Modified versions do not need to be open source
- Must acknowledge use of FreeRTOS in documentation/About screen
- Recommended to use the official CMSIS-RTOS v2 compatibility layer
1.2.3 Typical Application Scenarios
-
Industrial Control
- PLC Controllers (multi-task real-time scheduling)
- Motion Control (precise timing guarantees)
Consumer Electronics
- Smart Home Devices (low power management)
- Wearable Devices (memory optimization)
Automotive Electronics
- ECU Units (ASIL-B certified versions)
- In-vehicle Infotainment (multi-core expansion)
Internet of Things
- Edge Computing Nodes (LwIP + FreeRTOS)
- Wireless Sensors (low-power tickless mode)
Experimental Suggestions
Experiment 1.1: Create two tasks with different priorities and observe preemption behavior.Experiment 1.2: Measure context switching time using GPIO and an oscilloscope.