-
Notifications
You must be signed in to change notification settings - Fork 274
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
Add the esp-idf bootloader support crate #3281
base: main
Are you sure you want to change the base?
Conversation
1c49519
to
3844552
Compare
@@ -1,4 +1,5 @@ | |||
.rodata_desc : ALIGN(4) | |||
{ | |||
/* this might get replaced with actual data by build.rs */ | |||
KEEP(*(.rodata_desc)); |
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.
to make sure the linker won't discard it when nothing else is referencing it
const fn str_to_cstr_array<const C: usize>(s: &str) -> [::core::ffi::c_char; C] { | ||
let bytes = s.as_bytes(); | ||
if bytes.len() >= C { | ||
assert!(true, "String is too long for the C-string field"); |
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.
Should this be false
?
I suppose you could just move the bytes.len() < C
into the assert. 😄
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.
actually it's useless - the compiler will understand the overflow even before we can assert anything - so I removed this
(I admit, initially I pretty much just copied this code from somewhere)
Just a wild idea that popped up, could we/should we store the partition table as metadata for this crate (even if optionally, through a feature/config)? It's technically not part of the application itself, but it's I think also rare to have a single application work with multiple partition tables. |
You mean in Not entirely sure what the use-case would be? Maybe I just don't see the obvious 😆 But this sparked a different idea: Later I will add things like OTA and NVS support (which probably need to be features since they will change the available APIs) and we could encode that in the metadata to signal to the flashing tool (i.e. espflash) that an OTA / NVS partition is needed and refuse to flash if not 🤔 |
Thank you for your contribution!
We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:
Submission Checklist 📝
cargo xtask fmt-packages
command to ensure that all changed code is formatted correctly.CHANGELOG.md
in the proper section.Extra:
Pull Request Details 📖
Description
This adds the initial
esp-bootloader-support-esp-idf
- only supports the app-descriptor for nowSee #3124 (review)
Next steps would be
When we add MCUboot support we will have a similar crate for that
skip-changelog
because of the change to the linker scriptTesting
As said for now this offers limited functionality. To easily test that
examples
esp_bootloader_support_esp_idf::esp_app_desc!();
to one of the examplesespflash
to flash the example with the bootloader built above