SAMv7 Progmem driver byte write lead to ECC errors and flash data corruption
- Dominant language
- C
- Stars
- 4k
- Forks
- 1.7k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 237
Description
SAMv7 progmem (internal flash) driver does not perform byte writes correctly.
The driver assumes that it is possible to read page content, change erased (`0xFF`) bytes value and write page back to flash. That is usually a case for most of standard flashes, but SAMv7 internal flash has built-in ECC support, so applying such procedure destroys the flash content and rise "Multiple ECC Error" bit in `EEFC_FSR` register. The partial page programming of internal flash is of course possible, but with some restrictions specified in datasheet.
So only the first partial programming after erase is forking fine.
I found this and debugged for a while trying to place MTD config data on top of internal flash page.
Just logging it here as I do not plan to do anything with it, but this information may save investigation time for someone else.
Contributor guide
Assessment
This issue has not been assessed yet.