FlashDB
FlashDB copied to clipboard
New partitions are formatted twice on first run
In function check_sec_hdr_cb variable failed_count is incremented irrespective of return code from format_sector.
For new partitions failed_count gets incremented for all sectors
https://github.com/armink/FlashDB/blob/0b5ac0039b5c6dfb834ca8a5b958dd1a79a6bb5a/src/fdb_kvdb.c#L1432-L1448
In function _fdb_kv_load condition check_failed_count == SECTOR_NUM ends up being true for first run and triggers fdb_kv_set_default which reformats all the sectors again.
https://github.com/armink/FlashDB/blob/0b5ac0039b5c6dfb834ca8a5b958dd1a79a6bb5a/src/fdb_kvdb.c#L1499-L1539