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
Stm32f3: add flash support #2083
Conversation
the hil::flash::Flash trait and a generic struct for Stm32f303 Flash page.
Implement write and erase for the option bytes. Cleanup the comments.
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.
Thank you for this PR! I am excited to have flash support for an STM chip!
I have not completely reviewed this yet, but I left a few comments inline. One other comment: generally, we want upstream Tock boards to include support for all chip peripherals. This makes release testing much easier, and ensures that driver code continues to compile as Tock changes. Could you add the virtual flash to the stm32f3discovery board (using this driver) as part of this PR?
Co-authored-by: Hudson Ayers <32688905+hudson-ayers@users.noreply.github.com>
2. Added callbacks to PGERR and WRPRTERR
Could you give me some pointers in regards to adding the virtual flash? Do i have to write an additional flash capsule that I would use alongside the virtual flash capsule similar to what is done with the Alarm one? |
Sorry, I shouldn't have said virtual flash in my comment -- I just meant that there should be some capsule using the driver, instantiated in |
Ok. I'm on it! |
I have one question regarding the userspace address and length used by |
I am actually not sure how the userspace addresses/length are supposed to be chosen. Neither Imix nor the nrf52840dk assign the entire prog region as userspace accessible though, which makes me nervous that this does... @bradjc ? |
Used sstorage and estorage for the kernel address and length, as suggested. Changed the userspace address and length to 0x08038000 and 0x2000 in src/main.rs and chip_layout.ld to avoid overwriting the code segment
Ended up choosing 0x08038000 and 0x8000 (32KB) for the userspace address and length (prog being between 0x08020000 and 0x08040000). This leaves us with 96KB for the application binaries and 16 pages available for userspace programming. Imix does a similar thing, using 0x60000, while its prog area is between 0x40000 and 0x80000. Let me know if you have a different split in mind and sorry for having you review this twice. |
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.
I am happy with this PR, but would like if someone more familiar than me with how we assign userspace flash regions could double check that.
319d2f6
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.
I think this looks good -- one place where some comments would be valuable, but otherwise looks good to me
bors r+ |
Pull Request Overview
This pull request adds flash memory support for stm32f303xc (embedded flash and option bytes).
Testing Strategy
This pull request was tested using a stm32f3discovery kit. All the main operations have been tested and work properly (read, write, erase).
TODO or Help Wanted
I am still somewhat unsure about how to treat the callbacks from writing and erasing the option bytes.
Documentation Updated
/docs
, or no updates are required.Formatting
make prepush
.