embedded-shadow 0.1.0

Zero-alloc shadow register table with dirty tracking for embedded systems
Documentation
embedded-shadow-0.1.0 has been yanked.

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 embedded_shadow::prelude::*;

// Create a 1KB shadow register table
let storage = ShadowStorageBuilder::new()
    .total_size::<1024>()
    .block_size::<64>()
    .block_count::<16>()
    .default_access()
    .no_persist()
    .build();

// Host writes data (marks dirty)
let host = storage.host_shadow();
host.with_view(|view| {
    view.write_range(0x100, &[0x01, 0x02, 0x03, 0x04])?;
    Ok(())
});

// Kernel syncs dirty blocks to hardware
let kernel = storage.kernel_shadow();
kernel.with_view(|view| {
    view.for_each_dirty_block(|addr, data| {
        // Write to hardware registers
        hardware_write(addr, data);
        Ok(())
    })?;
    view.clear_dirty();
    Ok(())
});

Examples

See the examples directory for detailed usage:

Critical Section

This crate requires a critical-section implementation for your platform. Most embedded HALs provide this. For testing, add:

[dev-dependencies]
critical-section = { version = "1.2", features = ["std"] }

License

Licensed under either of:

at your option.