Skip to content

Check if bootloader has app descriptor #872

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 2 commits into
base: main
Choose a base branch
from

Conversation

JurajSadel
Copy link
Contributor

This checks, if the bootloader has an app desc present, if not, returns an error.
Also added an option for users to disable the check.

closes #866

let section = object.section_by_name(".rodata_desc").is_some();
let symbol = object.symbols().any(|sym| sym.name() == Ok("esp_app_desc"));

if !section || !symbol {
Copy link
Contributor

Choose a reason for hiding this comment

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

we probably could check more things like the size of the app-desc, the magic word at the start and the placement (i.e. address) but if the check fails on these we screwed up and we have hil-tests for that

@JurajSadel
Copy link
Contributor Author

I'm not sure if we need to check this on other places as well or flash() is enough 🤔

@@ -235,6 +236,16 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> {
// Read the ELF data from the build path and load it to the target.
let elf_data = fs::read(&args.image).into_diagnostic()?;

if args.flash_args.image.check_app_descriptor.unwrap_or(true) {
Copy link
Member

Choose a reason for hiding this comment

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

We also need this check in cargo-espflash. I suggest taking the guts of this block and extracting into a function in the library, which both binaries can call to do the check.

Copy link
Member

Choose a reason for hiding this comment

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

This check should also only be performed when using the esp-idf image format, which is why I had suggested holding off on this until those changes had been made.

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.

Detect applications where app desc is required, but not supplied
4 participants