#savegame #slot #flash #eeprom #nor #on-disk-format #wear-leveling #w25q

embedded-savegame

Savegame library for embedded with power-fail safety and wear leveling

3 releases (breaking)

Uses new Rust 2024

0.3.0 Jan 13, 2026
0.2.0 Dec 19, 2025
0.1.0 Dec 18, 2025

#482 in Embedded development

MIT/Apache

49KB
916 lines

embedded-savegame

Crates.io Documentation

A no_std savegame library for embedded systems with power-fail safety and wear leveling.

⚠️ Work in progress: The on-disk format may still change with no migration path between versions.

Supported Flash Hardware

  • AT24Cxx EEPROM (via eeprom24x feature)
  • W25Q NOR flash (via w25q feature)
  • Custom hardware (implement the Flash trait)

Quick Start

Add to your Cargo.toml:

[dependencies]
embedded-savegame = "0.2"

# Enable support for your flash hardware:
# embedded-savegame = { version = "0.2", features = ["eeprom24x"] }
# embedded-savegame = { version = "0.2", features = ["w25q"] }

Usage Example

use embedded_savegame::storage::{Storage, Slot};

// Configure storage: 64-byte slots, 8 total slots
const SLOT_SIZE: usize = 64;
const SLOT_COUNT: usize = 8;

// Create storage manager with your flash device
let mut storage = Storage::<_, SLOT_SIZE, SLOT_COUNT>::new(flash_device);

// Scan for existing savegame
if let Ok(Some(slot)) = storage.scan() {
    let mut buf = [0u8; 256];
    if let Ok(Some(data)) = storage.read(slot.idx, &mut buf) {
        // Process loaded savegame
        process_game_state(data);
    }
}

// Write a new savegame
let mut game_data = serialize_game_state();
storage.append(&mut game_data)?;

License

MIT OR Apache-2.0

Dependencies

~23–580KB