atsams-rs / atsamx7x-rust

Rust HAL, PACs, and examples for the Microship SAM E70/S70/V70/V71
Apache License 2.0
24 stars 11 forks source link

feat/efc: add API for read/erase/write flash #31

Open tmplt opened 1 year ago

tmplt commented 1 year ago

CC @martinmortsell

martinmortsell commented 10 months ago

All checks are finally passing.

Currently a user could generate multiple tokens for the same flash sector, I'm going to look into making sure that only one set of Sectors can be generated using the EFC singleton from the pac.

I am uncertain about the write_page method, in the past I've seen the compiler optimize away writes, but I have not managed to trigger that behaviour this time.

Apart from that, it would be nice to have better support for writing across multiple sectors, e.g. iterating across a subset of the sectors or similar.

martinmortsell commented 10 months ago

I have basically rewritten the FLash API from scratch, as I found the embedded-storage crate which defines traits for flash transfers. I'll look through the code tomorrow and see if I can break it somehow, but this is mostly ready for review now.

tmplt commented 10 months ago

I suggest rebasing upon master, and some squashing, to simplify the review.