How quantumleaps/miros works
Project Type and Purpose
• MiROS is an open-source teaching-aid RTOS kernel for ARM Cortex-M microcontrollers.
• It provides a simple, priority-based preemptive scheduler compliant with RMA/RMS.
• The project is structured as a library (kernel), board-support packages (BSPs), third-party dependencies (CMSIS), and example applications.
Main Architectural Components
a. MiROS Kernel Layer
– Public API (include/miros.h, include/qassert.h)
– Core implementation (src/<toolchain>/miros.c for ARMCLANG, GNU, IAR)
– RTOS primitives: task control blocks, scheduler, context switch, SysTick handler
b. Third-Party Layer
– CMSIS (3rd_party/CMSIS): core headers, NVIC, SysTick, MPU, etc.
– Board Support Packages (3rd_party/ek-tm4c123gxl, nucleo-c031c6, nucleo-l152re): startup code, device headers, system init
c. Example Applications
– “Blinky” demos (examples/blinky_*): tie together board-specific BSP, CMSIS, and MiROS kernel
d. Toolchain Abstraction
– ARMCLANG (src/armclang + project files under examples/*/armclang)
– GNU-ARM (src/gnu + Makefiles under examples/*/gnu)
– IAR EWARM (src/iar + project files under examples/*/iar)
Relationships and Data Flows
• Application (examples) → MiROS API calls
• MiROS Kernel → CMSIS core functions (SysTick, NVIC)
• MiROS Kernel → Board-Support (system clock init, GPIO)
• Build Flow: toolchain front-end compiles BSP + CMSIS + MiROS + application → linker produces firmware → flashed to hardware
Architectural Patterns and Principles
• Layered architecture
– Hardware at bottom
– CMSIS abstracts Cortex-M core
– BSP abstracts device peripherals
– MiROS provides RTOS services
– Examples sit at top (user code)
• Separation of concerns
– One kernel core, multiple toolchain ports
– Reusable BSP per board
• Minimal coupling, maximal clarity (teaching focus)
Essential Elements
– Labels for key files/directories