pw_kvs: Implement KVS load from flash
This starts the implementation of loading the KVS from flash. Much
remains to do before this is done. This patch also includes some
extensions to how the tests are handled, to make it easier to
instantiate multiple KVS and flash backends for testing.
Changes is this CL to potentially split out:
- KVS dump command to log contents
- Re-enabling function and file display in log (useful!)
- Hex dumping to log
Change-Id: Ib1b25a01aa29eec3d3acd09e40205c23ded7bf6a
diff --git a/pw_kvs/public/pw_kvs/flash_memory.h b/pw_kvs/public/pw_kvs/flash_memory.h
index 06a5148..d61a896 100644
--- a/pw_kvs/public/pw_kvs/flash_memory.h
+++ b/pw_kvs/public/pw_kvs/flash_memory.h
@@ -156,6 +156,8 @@
// UNKNOWN, on HAL error
virtual Status Erase(Address address, size_t num_sectors);
+ Status Erase() { return Erase(0, this->sector_count()); }
+
// Reads bytes from flash into buffer. Blocking call.
// Returns: OK, on success.
// TIMEOUT, on timeout.
@@ -192,7 +194,7 @@
// Overridden by derived classes. The reported sector size is space available
// to users of FlashPartition. It accounts for space reserved in the sector
// for FlashPartition to store metadata.
- virtual uint32_t sector_size_bytes() const {
+ virtual size_t sector_size_bytes() const {
return flash_.sector_size_bytes();
}