oxigdal-embedded
Embedded systems support for OxiGDAL, providing no_std compatible geospatial processing for ARM, RISC-V, ESP32, and other embedded targets.
Features
- no_std Compatibility: Full support for bare-metal embedded systems
- Static Memory Pools: Predictable allocation behavior without heap
- Target-Specific Optimizations: ARM, RISC-V, and ESP32 support
- Power Management: Low-power operation modes and sleep states
- Real-Time Support: Deadline scheduling and watchdog timers
- Minimal Footprint: Lightweight geospatial primitives for constrained environments
- Pure Rust: No C/Fortran dependencies (COOLJAPAN policy)
Supported Targets
ARM
- ARM Cortex-M (M0, M0+, M3, M4, M7)
- ARM Cortex-A
- NEON SIMD support
- Hardware AES and CRC
RISC-V
- RV32I, RV64I
- Vector extension support
- Atomic operations
- Cache management
ESP32
- ESP32 (Xtensa LX6)
- ESP32-S2, ESP32-S3 (Xtensa LX7)
- ESP32-C3, ESP32-C6, ESP32-H2 (RISC-V)
- WiFi power management
- Hardware crypto acceleration
Modules
- alloc_utils: Custom allocators (bump, stack, arena)
- memory_pool: Static and block-based memory pools
- target: Target-specific optimizations
- power: Power management and voltage regulation
- realtime: Real-time scheduling and deadline management
- minimal: Minimal geospatial primitives
- buffer: Fixed-size and ring buffers
- sync: Synchronization primitives (mutex, semaphore, etc.)
- config: System configuration and presets
Usage
Basic Setup
use *;
use presets;
// Use a platform preset
let config = esp32;
// Create a static memory pool
static POOL: = new;
Power Management
use ;
let pm = new;
// Switch to low power mode
pm.request_mode.expect;
// Estimate battery life
use PowerEstimator;
let mut estimator = new; // 3.3V
estimator.set_current; // 100mA
let hours = estimator.battery_life_hours; // 2000mAh battery
Real-Time Scheduling
use ;
let scheduler = new; // 240MHz CPU
scheduler.init;
let deadline = hard; // 1ms deadline
scheduler.execute_with_deadline.expect;
Memory Pools
use ;
// Static bump allocator
let static_pool = new;
let ptr = static_pool.allocate.expect;
// Block pool for frequent allocations
let block_pool = new;
let block = block_pool.allocate.expect;
// Deallocate
unsafe
Synchronization
use ;
// Thread-safe counter
let counter = new;
counter.increment;
// Mutex for shared data
let mutex = new;
// Semaphore for resource counting
let sem = new;
sem.try_acquire.expect;
sem.release;
Configuration Presets
The crate provides pre-configured settings for common platforms:
use presets;
// ESP32 (240MHz, 520KB RAM)
let config = esp32;
// ESP32-C3 RISC-V (160MHz, 400KB RAM)
let config = esp32c3;
// ARM Cortex-M4 (168MHz, 192KB RAM)
let config = cortex_m4;
// Generic RISC-V (100MHz, 128KB RAM)
let config = riscv;
// Ultra-low-power (32MHz, 64KB RAM)
let config = ultra_low_power;
Features Flags
default: Includesallocfeaturestd: Enable standard library (disables no_std)alloc: Enable allocator supportarm: ARM-specific optimizationsriscv: RISC-V-specific optimizationsesp32: ESP32-specific featureslow-power: Power management featuresrealtime: Real-time scheduling supportminimal: Minimal feature set only
Memory Requirements
Minimal Configuration
- Code: ~20KB flash
- Static pool: 4KB RAM
- Block pool: 4KB RAM
- Total: ~28KB
Standard Configuration
- Code: ~40KB flash
- Static pool: 64KB RAM
- Block pool: 64KB RAM
- Total: ~168KB
High-Performance Configuration
- Code: ~60KB flash
- Static pool: 128KB RAM
- Block pool: 64KB RAM
- Total: ~252KB
Performance
Benchmarks on ESP32 (240MHz):
- Memory allocation: ~50ns (static pool)
- Memory deallocation: ~10ns (block pool)
- Coordinate distance: ~200ns
- Bounds intersection: ~100ns
- Power mode switch: ~5μs
Safety
All operations follow strict safety guidelines:
- No unwrap() calls (enforced by clippy)
- Bounds checking on all array accesses
- Validated memory alignment
- Lock-free atomic operations where possible
- Minimal unsafe code with documented safety invariants
License
Licensed under Apache-2.0.
Copyright (c) 2024-2026 COOLJAPAN OU (Team Kitasan)
Contributing
This crate is part of the OxiGDAL project. See the main repository for contribution guidelines.
See Also
- oxigdal-core - Core abstractions
- oxigdal-mobile - Mobile platform support
- oxigdal-wasm - WebAssembly support