simulation: rewrite the storage and simulation stack

This commit is contained in:
2026-03-27 22:44:15 +01:00
parent 8a3b2303a2
commit 4977746af1
9 changed files with 465 additions and 170 deletions

36
src/bin/reset.rs Normal file
View File

@@ -0,0 +1,36 @@
#![no_std]
#![no_main]
use embassy_executor::Spawner;
use esp_hal::clock::CpuClock;
use esp_hal::timer::systimer::SystemTimer;
use log::*;
use esp_backtrace as _;
use renderbug_bike::logging::RenderbugLogger;
use renderbug_bike::tasks::simulation::{SimDataStream, SimDataTable};
use renderbug_bike::simdata::*;
esp_bootloader_esp_idf::esp_app_desc!();
#[esp_rtos::main]
async fn main(spawner: Spawner) {
esp_alloc::heap_allocator!(size: 100000);
RenderbugLogger::init_logger();
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
let peripherals = esp_hal::init(config);
let sys_timer = SystemTimer::new(peripherals.SYSTIMER);
esp_rtos::start(sys_timer.alarm0);
let mut storage = renderbug_bike::storage::SharedFlash::new(esp_storage::FlashStorage::new(peripherals.FLASH));
let mut partition_buf = [8; 1024];
let partitions = esp_bootloader_esp_idf::partitions::read_partition_table(&mut storage, &mut partition_buf).unwrap();
let sim_partition = SimDataTable::find_partition(storage, partitions).expect("Could not find sim data partition!");
info!("Got partition: {sim_partition:?}");
SimDataTable::create(sim_partition).expect("Could not write empty sim partition");
error!("Overwrote sim data partition with a blank stream table");
}