I’ve created a library that provides eeprom-like access to the external flash. Please see the repo for documentation: https://github.com/m-mcgowan/spark-flashee-eeprom
- provides direct flash access and eeprom-like access
- can use all the external flash - emulates address erasable eeprom over specified regions (up to 1MB per region.)
- performs wear leveling so erases to the same page are distributed across all pages in the flash device, improving endurance.
- circular buffer for dumping in data for later retrieval (e.g. buffering data to be sent out over wifi.)
- streamed read/write interface for convenient saving and loading of data
- small memory overhead - uses 9 bits of data for each page of flash managed. No overhead for direct access to flash.
I’m rather proud of how this library was developed.
The library was developed first as a regular C++ GCC library, with unit and integration tests using Google Test. This was possible because of the key
I then coded a
SparkFlashDevice and compiled the code for the spark. I also ported over ArduinoUnit - let’s call it SparkUnit - and ported the integration tests from Google Test over to SparkUnit so that the same core set of integration tests that I had running on the desktop were now running on the spark. This gives a high confidence that the library is correct.