Skip to content

Conversation

@bjoernQ
Copy link
Contributor

@bjoernQ bjoernQ commented Nov 26, 2025

A Rust project with strip = true will discard the symbol we are looking for but the section is kept.

See #927 (comment)

This should fix that situation

@bjoernQ bjoernQ marked this pull request as ready for review November 26, 2025 11:47
@bugadani
Copy link
Contributor

Why the "for unknown reasons" part? https://doc.rust-lang.org/cargo/reference/profiles.html#strip says:

strip = true is equivalent to strip = "symbols"

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Nov 26, 2025

Why the "for unknown reasons" part? https://doc.rust-lang.org/cargo/reference/profiles.html#strip says:

strip = true is equivalent to strip = "symbols"

ah yeah ... ok makes a lot of sense - I assumed (without checking) it strips just debuginfo

@bjoernQ bjoernQ marked this pull request as draft November 26, 2025 12:17
@bjoernQ bjoernQ marked this pull request as ready for review November 26, 2025 12:23
@bjoernQ bjoernQ force-pushed the improve-app-desc-check branch from 0aa9a7a to 7414168 Compare November 27, 2025 07:46
Copy link
Member

@SergioGasquez SergioGasquez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@SergioGasquez SergioGasquez added this pull request to the merge queue Nov 27, 2025
Merged via the queue into main with commit 70bea62 Nov 27, 2025
41 checks passed
}

/// Check if the provided ELF contains the app descriptor required by [the IDF bootloader](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/bootloader.html).
pub fn check_idf_bootloader(elf_data: &Vec<u8>) -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just tried using this function in probe-rs to fix probe-rs/probe-rs#3564 and come on why are we returning a miette diagnostic from this...?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should change that! maybe there are more places like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but ... probably for 5.x since this is already published public API :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I've managed to work around it by this line - turning the diagnostic back into a string, and wrapping it into the espflash::Error::AppDescriptorNotPresent error, which it was supposed to be in the first place...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We either shouldn't use miette in the library, or embrace it and don't expose espflash's error type, but this hybrid mess is just sad.

but ... probably for 5.x since this is already published public API :(

We can extract the implementation into another function that returns the Result<(), Error> type, and just call that().into_diagnostic() in the current function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We either shouldn't use miette in the library, or embrace it and don't expose espflash's error type, but this hybrid mess is just sad.

+1 ... we probably shouldn't embrace it but scrape it from the API surface

We can extract the implementation into another function that returns the Result<(), Error> type, and just call that().into_diagnostic() in the current function.

sure - and deprecate the current function for now

Might be worth a separate issue ... pretty sure comments on a merged PR will be lost in an instant

@SergioGasquez SergioGasquez deleted the improve-app-desc-check branch November 28, 2025 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants