Load ELF data directly using probe_rs#690
Conversation
|
I flashed both the SP and RoT on Grapefruit, and everything looks fine. |
| humility-cli = { workspace = true } | ||
| clap = { workspace = true } | ||
| anyhow = { workspace = true } | ||
| parse_int = { workspace = true } |
There was a problem hiding this comment.
These were unused dependencies that I happened to notice while pruning.
There was a problem hiding this comment.
Pull request overview
This PR updates the flashing workflow to load ELF data directly via probe-rs instead of converting ELF to IHEX/SREC first, reducing dependencies and simplifying the flash pipeline. It also introduces a dedicated LoadError type for ProbeCore::load.
Changes:
- Switch
ProbeCore::loadto accept in-memory ELF bytes and program flash viaprobe-rs’s ELF loader/flash loader APIs. - Remove IHEX/SREC/tempfile-related conversion code and associated dependencies from the
flashandrebootlebycommands. - Prune workspace dependencies (
ihex,srec,tempfile,path-slash, etc.) and update lockfile accordingly.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| humility-probes-core/src/probe_rs.rs | Introduces LoadError and changes ProbeCore::load to program ELF bytes directly via probe-rs. |
| cmd/flash/src/lib.rs | Updates flash command to pass ELF bytes directly to core.load. |
| cmd/flash/Cargo.toml | Removes now-unneeded dependencies related to ELF→IHEX/SREC conversion. |
| cmd/rebootleby/Cargo.toml | Removes dependencies no longer used by the command. |
| Cargo.toml | Removes workspace-level dependencies that are no longer required. |
| Cargo.lock | Reflects dependency graph changes after removing IHEX/SREC/tempfile/etc. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// Loading is not allowed when `can_flash = false` | ||
| #[error("ProbeCore was constructed with can_flash = false")] | ||
| NotAllowed, |
| let erase_style = ProgressStyle::default_bar() | ||
| .template("humility: erasing [{bar:30}] {bytes}/{total_bytes}")?; | ||
| .template("humility: erasing [{bar:30}] {bytes}/{total_bytes}") | ||
| .unwrap(); | ||
| let flash_style = ProgressStyle::default_bar() | ||
| .template("humility: flashing [{bar:30}] {bytes}/{total_bytes}")?; | ||
| .template("humility: flashing [{bar:30}] {bytes}/{total_bytes}") | ||
| .unwrap(); |
There was a problem hiding this comment.
This is deliberate; the progress bar can only fail if it's given an invalid template string, and we won't do that (or will catch it quickly, because it's a loud failure mode).
b2d785b to
dd14be6
Compare
024eac3 to
869db6f
Compare
869db6f to
fe3045b
Compare
dd14be6 to
e4e0918
Compare
(staged on #689)
Now that we are using
probe-rsfor everything, we don't need to convert to IHEX / SREC. This lets us remove a bunch of dependencies. I also switchedProbeCore::loadto return a strong error type, while I was poking at it.This is a building block for a
humility flashlibrary.Bidding a fond farewell to the best docstring in the codebase, describing
elf_chunks: