Skip to content

Commit 70bea62

Browse files
authored
Improve app-descriptor detection (#975)
* Improve app-descriptor detection * CHANGELOG.md * Support esp-hal app with `strip=true` * Clarify * Fix rebase
1 parent 2baf269 commit 70bea62

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
- Corrected eFuse BLOCK0 definitions for ESP32-C2, ESP32-C3, and ESP32-S3 (#961)
2323
- Fixed Secure Download Mode detection on ESP32-P4 (#972)
2424
- Several fixes in `read_efuse` (#969)
25+
- Fixed a problem in detecting the app-descriptor for a project if `strip = true` is used (#975)
2526

2627
### Removed
2728

espflash/src/image_format/idf.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,10 +809,17 @@ where
809809
pub fn check_idf_bootloader(elf_data: &Vec<u8>) -> Result<()> {
810810
let object = File::parse(elf_data.as_slice()).into_diagnostic()?;
811811

812-
let has_app_desc = object.symbols().any(|sym| sym.name() == Ok("esp_app_desc"));
813-
let is_esp_hal = object.section_by_name(".espressif.metadata").is_some();
812+
// A project with `strip = true` will discard the
813+
// symbol we are looking for but the section is kept
814+
let has_app_desc = object.symbols().any(|sym| sym.name() == Ok("esp_app_desc"))
815+
|| object.section_by_name(".flash.appdesc").is_some()
816+
|| object.section_by_name(".rodata_desc").is_some();
814817

815818
if !has_app_desc {
819+
// when using `strip = true` we will (maybe wrongly) assume ESP-IDF
820+
// but at least it should still guide the user into the right direction
821+
let is_esp_hal = object.section_by_name(".espressif.metadata").is_some();
822+
816823
if is_esp_hal {
817824
return Err(Error::AppDescriptorNotPresent(
818825
"ESP-IDF App Descriptor (https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/app_image_format.html#application-description) missing in your`esp-hal` application.\n

0 commit comments

Comments
 (0)