Skip to content

Check app_desc _only_ for esp-hal projects #892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion espflash/src/image_format/esp_idf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -817,9 +817,12 @@ where
pub fn check_idf_bootloader(elf_data: &Vec<u8>) -> Result<()> {
let object = File::parse(elf_data.as_slice()).into_diagnostic()?;
let section = object.section_by_name(".rodata_desc").is_some();
let esp_hal = object.section_by_name(".espressif.metadata").is_some();
let symbol = object.symbols().any(|sym| sym.name() == Ok("esp_app_desc"));

if !section || !symbol {
// esp-hal specific, because it searches for the hard-coded esp_app_desc symbol
// in an ELF section
if esp_hal && (!section || !symbol) {
return Err(Error::AppDescriptorNotPresent).into_diagnostic();
Copy link
Member

Choose a reason for hiding this comment

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

I think this bit still needs some more work, based on my comment here: #886 (comment)

We should still return an error if the section is missing from either type of binary, but we should only tell users to use esp-bootloader-idf if we detect that it's an esp-hal binary. I'm hoping we can customize the error context with thiserror or miette for this purpose 🤞

}

Expand Down
Loading