embedded-shadow
A no_std, no-alloc shadow register table for embedded systems with dirty tracking and transactional writes.
Features
- Zero allocation - All storage is statically allocated via const generics
- Dirty tracking - Efficiently track which blocks have been modified
- Dual views - Separate Host (application) and Kernel (hardware) access patterns
- Access policies - Control read/write permissions for different memory regions
- Persistence policies - Define what and when data should be persisted
- Staging support - Preview and commit/rollback transactional writes
- Critical-section support - Thread-safe access when needed
Quick Start
use *;
// Create a 1KB shadow register table
let storage = new
.
.
.
.default_access
.no_persist
.build;
// Host writes data (marks dirty)
let host = storage.host_shadow;
host.with_view;
// Kernel syncs dirty blocks to hardware
let kernel = storage.kernel_shadow;
kernel.with_view;
Examples
See the examples directory for detailed usage:
basic.rs- Core concepts and dirty trackingstaging.rs- Transactional writes with preview/commit/rollbackaccess_policy.rs- Memory protection and access controlpersist.rs- Flash persistence patternscomplex.rs- Real-world motor controller simulation
Critical Section
This crate requires a critical-section implementation for your platform. Most embedded HALs provide this. For testing, add:
[]
= { = "1.2", = ["std"] }
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.