Move humility flash to a library#699
Open
mkeeter wants to merge 5 commits into
Open
Conversation
mkeeter
commented
Jun 10, 2026
| #[clap(long, short = 'F')] | ||
| force: bool, | ||
|
|
||
| /// if using OpenOCD, do not actually flash, but show commands and retain |
Contributor
Author
There was a problem hiding this comment.
These arguments were only used for OpenOCD, which is no longer used.
mkeeter
commented
Jun 10, 2026
Comment on lines
-75
to
-81
| /// If `subargs.check` is true, returns `Ok(())` on a clean check and `Err(..)` | ||
| /// otherwise; the core is left running. | ||
| /// | ||
| /// If `subargs.check` is false, returns `Ok(())` if the check _fails_ (meaning | ||
| /// we should reflash), and `Err(..)` if all checks pass (meaning we should | ||
| /// _not_ reflash). The core is left halted if we should reflash and is running | ||
| /// otherwise. |
Contributor
Author
There was a problem hiding this comment.
RIP to the most confusing function semantics in Humility
mkeeter
commented
Jun 10, 2026
| pub metadata: HubrisFlashMeta, | ||
| pub elf: Vec<u8>, | ||
| pub chip: Option<String>, | ||
| } |
Contributor
Author
There was a problem hiding this comment.
This is no longer used as a single object; I've exposed helper functions to get both the elf and chip data individually.
mkeeter
commented
Jun 10, 2026
| "cmd/validate", | ||
| "cmd/vpd", | ||
| "cmd/writeword", | ||
| "xtask", "humility-log", |
Contributor
Author
There was a problem hiding this comment.
Dunno what was going on here, but I fixed it.
mkeeter
commented
Jun 10, 2026
| mod unattached; | ||
|
|
||
| pub use probe_rs::ProbeCore; | ||
| pub use probe_rs::{LoadError, ProbeCore}; |
Contributor
Author
There was a problem hiding this comment.
This is newly public because ProgramImageError::LoadFailed wraps it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves the bulk of
humility flashinto a library crate. There are two main entry points:get_image_statetells us whether the current image matches or notprogram_imageflashes an image (and auxflash)As always, things are fully documented and use strong error types.
The logic is broadly the same as before, but has been tightened in a few places. For example, in the old implementation, any error while checking image state (e.g. a probe error) would lead to Humility trying to reflash the image; our new implementation distinguishes between "image matches / doesn't match" and Humility-level errors.
There's one small API change:
HubrisArchive::chipnow returns aResult<String>(instead of anOption<String>). In 2026, we should never be trying to flash / reset an archive which does not include the chip name (and this isn't used in post-mortem debugging, so it's fine to be less backwards-compatible).