This repository contains my practical experiments and learning progression with FreeRTOS using the Arduino IDE. The project consists of .ino sketches designed to explore the fundamental mechanisms of real-time operating systems, from basic task scheduling to utilizing multiple cores and performance monitoring.
The repository includes four distinct .ino sketches, each focusing on a specific RTOS concept:
- Core Concept: Task creation and basic scheduling.
- Details: Demonstrates how to create multiple tasks, assign priorities, and understand the FreeRTOS scheduler. It covers the foundational
xTaskCreateAPI and how the OS switches contexts between two active processes running in a loop.
- Core Concept: Symmetric/Asymmetric Multiprocessing (SMP).
- Details: Explores pinning specific tasks to different processor cores using
xTaskCreatePinnedToCore(highly relevant for microcontrollers like the ESP32). Demonstrates true parallel execution and hardware resource management.
- Core Concept: Deterministic execution and blocking delays.
- Details: Focuses on precise timing using FreeRTOS tick interrupts. It contrasts standard Arduino
delay()with FreeRTOS blocking (vTaskDelayandvTaskDelayUntil) to ensure periodic tasks run exactly when they need to without starving the CPU.
- Core Concept: System profiling and debugging.
- Details: Implements runtime statistics gathering to monitor CPU utilization per task. It utilizes FreeRTOS APIs to analyze performance bottlenecks, check high-water marks for stack memory, and ensure critical processes are healthy.
- Task Management: Memory allocation for tasks, stack size considerations, and priority-based preemptive scheduling within the Arduino loop.
- Concurrency: Managing parallel operations across multiple cores without race conditions.
- Timing Constraints: Designing deterministic systems that meet strict real-time deadlines.
- Profiling: Measuring system health and debugging resource allocation.
To run these examples, you will need a microcontroller that supports FreeRTOS and has multiple cores (an ESP32 is highly recommended for the dual-core sketch) and the Arduino IDE.
- Clone the repository:
git clone https://github.com/sxumit/learning-freertos.git