From bf77b30abb35074ee44713f3173d9895144d5932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Quentin?= Date: Wed, 26 Nov 2025 12:34:39 +0100 Subject: [PATCH 1/5] Improve app-descriptor detection --- CHANGELOG.md | 1 + espflash/src/image_format/idf.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9d5f449..f5d6fd44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Corrected eFuse BLOCK0 definitions for ESP32-C2, ESP32-C3, and ESP32-S3 (#961) - Fixed Secure Download Mode detection on ESP32-P4 (#972) - Several fixes in `read_efuse` (#969) +- Fixed a problem in detecting the app-descriptor for a Rust-std project if `strip = true` is used ### Removed diff --git a/espflash/src/image_format/idf.rs b/espflash/src/image_format/idf.rs index 7223b260..1c8e9543 100644 --- a/espflash/src/image_format/idf.rs +++ b/espflash/src/image_format/idf.rs @@ -809,7 +809,10 @@ where pub fn check_idf_bootloader(elf_data: &Vec) -> Result<()> { let object = File::parse(elf_data.as_slice()).into_diagnostic()?; - let has_app_desc = object.symbols().any(|sym| sym.name() == Ok("esp_app_desc")); + // for unknown reasons a Rust-std project with `strip = true` will discard the + // symbol we are looking for but the section is kept + let has_app_desc = object.symbols().any(|sym| sym.name() == Ok("esp_app_desc")) + || object.section_by_name(".flash.appdesc").is_some(); let is_esp_hal = object.section_by_name(".espressif.metadata").is_some(); if !has_app_desc { From 7fa5fb433e4a0c30c786f974737e6780f1416b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Quentin?= Date: Wed, 26 Nov 2025 12:37:24 +0100 Subject: [PATCH 2/5] CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5d6fd44..c1f33026 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed Secure Download Mode detection on ESP32-P4 (#972) - Several fixes in `read_efuse` (#969) - Fixed a problem in detecting the app-descriptor for a Rust-std project if `strip = true` is used +- Fixed a problem in detecting the app-descriptor for a Rust-std project if `strip = true` is used (#975) ### Removed From 28340be4a10a402729339bab51a7a58ae66471cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Quentin?= Date: Wed, 26 Nov 2025 13:21:47 +0100 Subject: [PATCH 3/5] Support esp-hal app with `strip=true` --- espflash/src/image_format/idf.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/espflash/src/image_format/idf.rs b/espflash/src/image_format/idf.rs index 1c8e9543..7fbb9455 100644 --- a/espflash/src/image_format/idf.rs +++ b/espflash/src/image_format/idf.rs @@ -809,13 +809,17 @@ where pub fn check_idf_bootloader(elf_data: &Vec) -> Result<()> { let object = File::parse(elf_data.as_slice()).into_diagnostic()?; - // for unknown reasons a Rust-std project with `strip = true` will discard the + // A project with `strip = true` will discard the // symbol we are looking for but the section is kept let has_app_desc = object.symbols().any(|sym| sym.name() == Ok("esp_app_desc")) - || object.section_by_name(".flash.appdesc").is_some(); - let is_esp_hal = object.section_by_name(".espressif.metadata").is_some(); + || object.section_by_name(".flash.appdesc").is_some() + || object.section_by_name(".rodata_desc").is_some(); if !has_app_desc { + // when using `strip = true` we will (maybe wrongly) assume ESP-IDF + // but at least it should still guide the user into the right direction + let is_esp_hal = object.section_by_name(".espressif.metadata").is_some(); + if is_esp_hal { return Err(Error::AppDescriptorNotPresent( "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 From 74141687e63157711a75cede949a3c378dad1260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Quentin?= Date: Wed, 26 Nov 2025 13:23:53 +0100 Subject: [PATCH 4/5] Clarify --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1f33026..22882a43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Several fixes in `read_efuse` (#969) - Fixed a problem in detecting the app-descriptor for a Rust-std project if `strip = true` is used - Fixed a problem in detecting the app-descriptor for a Rust-std project if `strip = true` is used (#975) +- Fixed a problem in detecting the app-descriptor for a project if `strip = true` is used (#975) ### Removed From 1fd5b59b18fd22a100d3e004ea21e23062e3a02a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Quentin?= Date: Thu, 27 Nov 2025 11:33:08 +0100 Subject: [PATCH 5/5] Fix rebase --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22882a43..b49c40c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,8 +20,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Corrected eFuse BLOCK0 definitions for ESP32-C2, ESP32-C3, and ESP32-S3 (#961) - Fixed Secure Download Mode detection on ESP32-P4 (#972) - Several fixes in `read_efuse` (#969) -- Fixed a problem in detecting the app-descriptor for a Rust-std project if `strip = true` is used -- Fixed a problem in detecting the app-descriptor for a Rust-std project if `strip = true` is used (#975) - Fixed a problem in detecting the app-descriptor for a project if `strip = true` is used (#975) ### Removed