Crates.io | esp-hal-ota |
lib.rs | esp-hal-ota |
version | |
source | src |
created_at | 2024-07-22 18:19:21.548059+00 |
updated_at | 2025-02-27 14:09:37.321385+00 |
description | OTA library for esp-hal |
homepage | |
repository | https://github.com/filipton/esp-hal-ota |
max_upload_size | |
id | 1311452 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
OTA for esp-hal (no-std).
I cannot test if it works properly on esp32s2,esp32c2,esp32c6 and esp32h2. But esp32s3, esp32c3 and esp32 are working perfectly fine.
partitions.csv
file in project root (copy partitions.csv.template
file)./.cargo/config.toml
file and append -T ./partitions.csv
to the runner
attribute--erase-parts otadata
to ./cargo/config.toml
to fix some ota issues[target.xtensa-esp32s3-none-elf]
runner = "espflash flash --monitor -T ./partitions.csv --erase-parts otadata"
To see real-world example look at ./examples
and ./simple-ota-server
dirs.
let flash_size = 1234; // get it from OTA server
let target_crc = 65436743; // get it from OTA server
let mut ota = Ota::new(FlashStorage::new()).unwrap();
ota.ota_begin(flash_size, target_crc);
let mut buf = [0; 4096];
loop {
let n = read_next_chunk(&mut buf);
if n == 0 {
break;
}
let res = ota.ota_write_chunk(&buf[..n]);
if res == Ok(true) { // end of flash
if ota.ota_flush(true, true).is_ok() { // true if you want to verify crc reading flash, and true if you want rollbacks
esp_hal::reset::software_reset();
}
}
let progress = (ota.get_ota_progress() * 100) as u8;
log::info!("progress: {}%", progress);
}
espflash save-image --chip esp32c3 ./target/riscv32imc-unknown-none-elf/debug/esp-hal-ota-example ../simple-ota-server/firmware.bin
This will generate .bin file from build file for chip.