-
Notifications
You must be signed in to change notification settings - Fork 140
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
base: main
Are you sure you want to change the base?
Conversation
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 { |
There was a problem hiding this comment.
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
I'm not sure if we need to check this on other places as well or |
@@ -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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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