Add disk storage support (SD cards) #2584
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR extends the Storage system to support block-based devices such as SD cards.
Storage sizes have been changed from
uint32_t
tostorage_size_t
. Default operation is unchanged, but this allows 64-bit offsets to be used to support devices greater than about 4GB.The existing
SDCard
library has been taken and reworked extensively with added GNU/Linux source code to handle MBR/GPT partitioning. The result is theDiskStorage
base library, which is then used by theSdStorage
library to provide specific SD card support, currently using SPI.Optional buffering for block devices is included to support other filing systems. LittleFS appears to work but Spiffs doesn't - it requires erased sectors to be 0xFF which is fundamentally incompatible.
Finally, the
FatIFS
library has been added, using the current version of Chan's fatfs library. There are some minor modifications in the code to fix time handling and simplify use.Testing for these libraries has been implemented by verifying generated filesystem images using standard GNU/Linux tools.