$ show n7space/aerugo
Aerugo is a safety-critical real-time operating system (RTOS) for embedded systems, specifically targeting the ARM Cortex-M7 (ATSAMV71) microcontroller. Developed under an ESA contract for space applications, it provides a non-preemptive, cooperative scheduler based on fine-grained tasklets, along with event-driven and cyclic execution, message queues, boolean conditions, and execution monitoring. The system is designed for static allocation, no dynamic memory, and no_std environments. The repository includes a full hardware abstraction layer (HAL) for the SAMV71, covering SPI, UART, PIO, timers, watchdog, XDMAC, PMC, FPU, and more, built on top of an auto-generated peripheral access crate (PAC) from the vendor SVD. A custom Python test framework (calldwell) enables hardware-in-the-loop testing via RTT, GDB, and SSH, with formal requirements traceability embedded in test code. The architecture is modular: the core RTOS kernel resides in `src/`, platform-specific code in `arch/` (Cortex-M and x86), and reusable utilities in `utils/` (bitfield-enum macro, bounded integers, LSM6DSO IMU driver). The HAL uses typestate patterns to enforce correct driver configuration at compile time. The codebase demonstrates strong Rust embedded engineering practices, including manual vtables for type erasure, critical-section-based mutexes, and static resource management via OnceCell. However, it relies on nightly Rust features (const_mut_refs, proc_macro_tracked_env) and the PAC is auto-generated, introducing maintenance risks. The project is actively developed with a comprehensive test suite and real-world demos (e.g., SPI accelerometer with CCSDS telemetry).
The LLM identified 5 files worth highlighting for reuse:
Provides a `bitfield_enum!` macro that generates bitfield enums with `TryFrom<u8>`/`From<u8>` conversions and field accessors. This is a standalone utility crate that can be reused in any embedded project requiring safe, ergonomic bitfield handling without external dependencies.
Implements a `generic_bounded_value!` macro that creates compile-time bounded integer types (e.g., `BoundedU8<0, 100>`) with `new`, `new_saturated`, `get`, and `Deref`. Used throughout the HAL and demos for safe configuration values. Easily extractable for any Rust project needing constrained integers.
A fixed-capacity, singly-linked list built on `UnsafeCell` for safe static allocation. Allows push operations during initialization and read-only iteration afterwards. Demonstrates a pattern for building static data structures without dynamic allocation, reusable in any no_std context.
A simple critical-section-based mutex wrapping `UnsafeCell<T>`. Provides `lock` with a closure to ensure mutual exclusion. This is a minimal, safe, and portable mutex implementation suitable for single-core embedded systems, easily extracted for other projects.
Part of the calldwell test framework, this module provides a Python GDB client for controlling embedded targets (connect, step, continue, set breakpoints, read memory). It abstracts GDB's MI interface and is reusable for any embedded project needing automated hardware testing via GDB.