embassy-rs / embassy-rs/static-cell
Static cell doesn't work with link sections in memory that is not zeroed
- Dominant language
- Rust
- Stars
- 69
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
If you use a link section with the static, you need to make sure that it is in a region that is zeroed on reset otherwise on the second run the static cell will think it's already been initialized and panic when it hasn't. Ideally there would be a way to separate the atomic bool from the data, so that the compiler can put the atomic bool with all of the other normal statics and the custom link section only applies to the MaybeUninit data.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the second-run failure with a static cell placed in a non-zeroed link section, then inspect the static-cell initialization behavior and reset assumptions. Determine how the initialization flag and MaybeUninit data are currently placed. Done means the static cell can be safely reused after reset without falsely treating its data as initialized.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100