nvs-flash: Support for blobs larger than half of SPI Flash sector size

This change removes the earlier limitation of 1984 bytes for storing data-blobs.
Blobs larger than the sector size are split and stored on multiple sectors.
For this purpose, two new datatypes (multi-page index and multi-page data) are
added for entries stored in the sectors. The underlying read, write, erase and find
operations are modified to support these large blobs. The change is transparent
to users of the library and no special APIs need to be used to store these large
blobs.
This commit is contained in:
Sagar Bijwe
2018-04-02 16:14:59 +05:30
parent 8809fabcd5
commit 5a27a63541
16 changed files with 1224 additions and 170 deletions
@@ -43,7 +43,8 @@ public:
{
load(filename);
// Atleast one page should be free, hence we create mData of size of 2 sectors.
mData.resize(2 * SPI_FLASH_SEC_SIZE / 4, 0xffffffff);
mData.resize(mData.size() + SPI_FLASH_SEC_SIZE / 4, 0xffffffff);
mUpperSectorBound = mData.size() * 4 / SPI_FLASH_SEC_SIZE;
spi_flash_emulator_set(this);
}