Commit Graph

4 Commits (3082c28b1efae0feba02ef8459c6ce3ef2983256)

Author SHA1 Message Date
Matthias Goebel 3082c28b1e skip CRC when initializing TDBStore
Problem: The build_ram_table() function of TDBStore loops over every entry, calculates the checksum and compares them to the stored checksum in the entry header to ensure integrity. For larger TDBStores (e.g. 8 MiB or more) in external single-SPI flash devices this check can take very long, thus rendering it unusable in some cases.

Solution: The suggested solution skips the time consuming CRC of the data. After reading the key and calculating its CRC, it sets next_offset to the beginning of the next entry, thereby skipping the data. While this skips the integrity check, it significantly reduces the initial building of the RAM table.

The data CRC can be enabled or disabled with a compiler flag.

Contribution is provided on behalf of BIOTRONIK.
2024-05-22 12:05:09 +02:00
Lingkai Dong aedc6009ea TDBStore: call `BlockDevice::erase()` regarless of erase value
From the documentations of `BlockDevice::get_erase_value()`:

    -1 if you can't rely on the value of the erased storage

and `BlockDevice::program()`:

    The blocks must have been erased prior to being programmed

So, `BlockDevice::erase()` should always be called regardless of
erase value.
2021-04-14 17:19:38 +01:00
Lingkai Dong fb4e5e80b4 TDBStore: optimize erase algorithms
Currently `TDBStore::offset_in_erase_unit()` and
`TDBStore::check_erase_before_write()` loop through erase units
one-by-one, until the entire range is covered. This is very inefficient
when the erase size is tiny, e.g. one-byte on a non-flash device for
which we use program as erase.

This commit reworks the algorithms, based on the fact that a block
device can erase or program as many units as needed in one go.
2021-04-14 17:19:38 +01:00
Lingkai Dong c2d6e9146c Turn TDBStore and FileSystemStore into standalone libraries 2020-12-09 17:20:42 +00:00