Skip to content

esp_bootloader_esp_idf::esp_app_desc!() optimized out. #4682

@sarahkittyy

Description

@sarahkittyy

Bug description

esp_bootloader_esp_idf::esp_app_desc!() has its symbol optimized out, leading to espflash returning "ESP-IDF App Descriptor missing in your esp-hal application."

To Reproduce

Cargo.toml

[package]
...

[dependencies]
esp-backtrace = { version = "0.18.0", features = [
    "esp32s3",
    "panic-handler",
    "println",
] }
esp-hal = { version = "1.0.0", features = [ "esp32s3", "unstable", "rt" ] }
esp-println = { version = "0.16.1", features = ["esp32s3", "log-04"] }
log = { version = "0.4.29" }
esp-alloc = { version = "0.9.0" }
embedded-svc = { version = "0.28.1", default-features = false, features = [] }
embedded-io = "0.7.1"
esp-radio = { version = "0.17.0", features = [
    "esp32s3",
    "wifi",
    "log-04"
] }
gc9a01-rs = "0.4.2"
embedded-graphics = "0.8.1"
embedded-hal = "1.0.0"
embedded-hal-bus = "0.3.0"
micromath = "2.1.0"
critical-section = "1.2.0"
nb = "1.1"
esp-bootloader-esp-idf = { version = "0.4.0", features = ["esp32s3", "log-04"] }

[profile.release]
codegen-units = 1
debug = 2
debug-assertions = false
incremental = false
lto = 'fat'
opt-level = 's'
overflow-checks = false

[profile.dev]
debug = true    # Symbols are nice and they don't increase the size on Flash
opt-level = 's'

[profile.dev.package.esp-radio]
opt-level = 3

[profile.release.package.esp-radio]
opt-level = 3
  • With just the macro: esp_bootloader_esp_idf::esp_app_desc!();, xtensa-esp32s3-elf-objdump -t ./target/xtensa-esp32s3-none-elf/debug/sarah-watch | grep -i "esp_app_desc" returns nothing.
  • Using the macro's expansion:
#[export_name = "esp_app_desc"]
#[link_section = ".rodata_desc.appdesc"]
pub static ESP_APP_DESC: esp_bootloader_esp_idf::EspAppDesc =
    esp_bootloader_esp_idf::EspAppDesc::new_internal(
        env!("CARGO_PKG_VERSION"),
        env!("CARGO_PKG_NAME"),
        esp_bootloader_esp_idf::BUILD_TIME,
        esp_bootloader_esp_idf::BUILD_DATE,
        esp_bootloader_esp_idf::ESP_IDF_COMPATIBLE_VERSION,
        0,
        u16::MAX,
        esp_bootloader_esp_idf::MMU_PAGE_SIZE,
    );

-- objdump also returns nothing

  • Using above, but with #[used] in front, shows 00405edc g O .rodata_desc.appdesc 00000100 esp_app_desc (Expected behavior)

Expected behavior

I think the compiler is optimizing the variable out. Perhaps I'm not using the macro right. Any advice?

Environment

  • Target device: ESP32S3
  • Darwin sarah-mac-3.local 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:34:05 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6041 arm64
  • rustc --version
    rustc 1.90.0-nightly (abf50ae2e 2025-09-16) (1.90.0.0)

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions