Crate cortex_m_rtfm [−] [src]
Real Time For the Masses (RTFM) framework for ARM Cortex-M microcontrollers
This crate is based on the RTFM framework created by the Embedded Systems group at Luleå University of Technology, led by Prof. Per Lindgren, and uses a simplified version of the Stack Resource Policy as scheduling policy (check the references for details).
- Event triggered tasks as the unit of concurrency.
- Support for prioritization of tasks and, thus, preemptive multitasking.
- Efficient and data race free memory sharing through fine grained non global critical sections.
- Deadlock free execution guaranteed at compile time.
- Minimal scheduling overhead as the scheduler has no "software component": the hardware does all the scheduling.
- Highly efficient memory usage: All the tasks share a single call stack and there's no hard dependency on a dynamic memory allocator.
- All Cortex M devices are fully supported.
- This task model is amenable to known WCET (Worst Case Execution Time) analysis and scheduling analysis techniques. (Though we haven't yet developed Rust friendly tooling for that.)
Tasks must run to completion. That's it, tasks can't contain endless loops. However, you can run an endless event loop in the
Task priorities must remain constant at runtime.
The application crate must depend on a device crate generated using
svd2rust v0.12.x and the "rt" feature of that crate must be enabled. The
SVD file used to generate the device crate must contain
app! macro is documented here.
If targeting a Cortex-M7 device with revision r0p1 then you MUST enable the
feature of this crate or the
Resource.claim_mut methods WILL misbehave.
In increasing grade of complexity. See the examples module.
- Baker, T. P. (1991). Stack-based scheduling of realtime processes. Real-Time Systems, 3(1), 67-99.
The original Stack Resource Policy paper. PDF.
- Eriksson, J., Häggström, F., Aittamaa, S., Kruglyak, A., & Lindgren, P. (2013, June). Real-time for the masses, step 1: Programming API and static priority SRP kernel primitives. In Industrial Embedded Systems (SIES), 2013 8th IEEE International Symposium on (pp. 110-113). IEEE.
A description of the RTFM task and resource model. PDF
Preemption threshold token
A resource, a mechanism to share data between tasks
Executes the closure
Puts the processor in Debug state. Debuggers can pick this up as a "breakpoint".
Sets an interrupt, that is a task, as pending
Wait For Interrupt