rivet-arch-cortex-m 0.2.0

Rivet RTOS: ARM Cortex-M ISA port (context switch, PendSV, MPU) — no board/MMIO knowledge
Documentation
  • Coverage
  • 88.89%
    8 out of 9 items documented0 out of 4 items with examples
  • Size
  • Source code size: 53.56 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 203.04 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • habeelali/rivet-rtos
    9 0 3
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • habeelali

Rivet RTOS — ARM Cortex-M ISA port.

Implements the Group A (rivet::port::arch) symbol contract for Cortex-M targets: PendSV context switch, MemManage fault handling, MPU programming, SysTick tick source. Contains no board/MMIO knowledge beyond what's genuinely part of the Cortex-M architecture (SCB, MPU, SysTick, and their fixed System Control Space addresses — identical on every Cortex-M3/4/7/33). A board's clock rate, console, and exit/reset path are supplied separately by a rivet-bsp-* crate.

Preemptive context switch

Tasks run in Thread mode using PSP (Process Stack Pointer); exceptions (SysTick, PendSV, everything else) always run in Handler mode using MSP (Main Stack Pointer) — automatic Cortex-M behavior. That split matters: a PendSV handler's own nested Rust calls (the scheduler, atomics, etc.) run on MSP, never touching a task's PSP-based stack — no RISC-V-style risk of the scheduler's own call chain competing for space with whatever a task had reserved for itself.

Following ARM's recommended pattern: SysTick only requests a reschedule (SCB.ICSR.PENDSVSET); the actual register save/restore and scheduling decision happen in PendSV, which — being the lowest-priority exception — never preempts a higher-priority ISR mid-flight.