Introduction
I am developing a high level library to read and write for winbond W25Q512JV and ATmega32U4 mcu.
From the flash datasheet:
The Page Program instruction allows from one byte to 256 bytes (a page) of data to be programmed at previously erased (FFh) memory locations.
Additionally the smaller amount you can erase are 4kB (a sector).
Problem
To overwrite data on the flash device the process it seems like I must:
- Read sector involved
- Erase sector
- Write whole sector
However when reading the sector that can be up to 4k length which is quite huge to keep on the memory stack. What is the best approach for this cases?