Skip to content

Commit

Permalink
Crude POC for flash ESP app images instead of ELF files (esp-rs#770)
Browse files Browse the repository at this point in the history
  • Loading branch information
AVee committed Feb 17, 2025
1 parent a559957 commit 84a422e
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 19 deletions.
113 changes: 104 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion espflash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ defmt-parser = { version = "=0.4.1", features = ["unstable"], optional = true
dialoguer = { version = "0.11.0", optional = true }
directories = { version = "5.0.1", optional = true }
env_logger = { version = "0.11.6", optional = true }
esp-idf-part = "0.5.0"
esp-idf-part = { version = "0.5.0", git = "https://github.com/esp-rs/esp-idf-part", rev = "8cb16c0254d8299fe5a4a692e460f73844e024bf" }
flate2 = "1.0.35"
hex = { version = "0.4.3", features = ["serde"] }
indicatif = { version = "0.17.9", optional = true }
Expand Down
1 change: 1 addition & 0 deletions espflash/src/bin/espflash.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use espflash::image_format;
use std::{
fs::{self, File},
io::Read,
Expand Down
1 change: 0 additions & 1 deletion espflash/src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::{
};

use xmas_elf::{
program::Type,
sections::{SectionData, ShType},
ElfFile,
};
Expand Down
2 changes: 1 addition & 1 deletion espflash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub mod flasher;
pub mod image_format;
pub mod targets;

mod elf;
pub mod elf;
mod error;

// Command-line interface
Expand Down
8 changes: 1 addition & 7 deletions espflash/src/targets/flash_target/esp32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use flate2::{
write::{ZlibDecoder, ZlibEncoder},
Compression,
};
use log::{info, warn};
use log::info;
use md5::{Digest, Md5};

#[cfg(feature = "serialport")]
Expand Down Expand Up @@ -159,12 +159,6 @@ impl FlashTarget for Esp32Target {
.try_into()
})?;

if addr == 0x10000 {
warn!("Writing!");
std::fs::write("/home/avee/projects/xldata/flash/segment_md5_bin", &segment.data).unwrap();
}
info!("MD5 checksum: {:?}", checksum_md5);
info!("Flash MD5 checksum: {:?}", flash_checksum_md5.to_be_bytes());
if checksum_md5.as_slice() == flash_checksum_md5.to_be_bytes() {
info!(
"Segment at address '0x{:x}' has not changed, skipping write",
Expand Down

0 comments on commit 84a422e

Please sign in to comment.