Skip to content
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

Panic on firmware information #378

Open
stabl-gjn opened this issue Mar 4, 2024 · 2 comments
Open

Panic on firmware information #378

stabl-gjn opened this issue Mar 4, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@stabl-gjn
Copy link
Contributor

stabl-gjn commented Mar 4, 2024

Relevant code:

esp-idf-svc/src/ota.rs

Lines 33 to 35 in 730fa36

version: unsafe { from_cstr_ptr(&app_desc.version as *const _) }
.try_into()
.unwrap(),

esp-idf-svc panics if the firmware version of esp_app_desc_t.version (and other related fields) is longer than 24 chars.

The upper limit (24 chars) is defined by embedded_svc.
esp-idf-svc takes the version provided by esp-idf and tries to convert it into heapless::String::<24> panicking if the version is any longer.

In our project the version used by esp-idf-svc is the output of git describe which is quite big (e.g. v0.3.0-146-gd33fb261-dirty) and leads to a uncontrollable panic.

I think, at least the unwrap should be replaced by an except to give the developer any idea of what went wrong or in the better case be handled (in what ever way, e.g. truncate, Result/Option)

esp-idf app version description: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/misc_system_api.html#app-version

@Vollbrecht
Copy link
Collaborator

Vollbrecht commented Mar 4, 2024

to set the correct firmware name i would suggest, you are using the app_desc makro we provide. That way you get a version controlled information and build time information, all set via your usual Cargo.toml. That way the information in the descriptor is based on your rust app and not on the esp-idf static lib the project is linked into.

@stabl-gjn
Copy link
Contributor Author

stabl-gjn commented Mar 5, 2024

@Vollbrecht thanks i will try that for now

Update:
Works but as the git thing is the default behavior (and the default matters), i still think there should be something done about it.

I am happy to help with implementing it once/if there is a path on what to do.

@Vollbrecht Vollbrecht added the bug Something isn't working label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants