pw_kvs: FlashMemory updates; test utilities

- Update comments for FlashMemory class.
- Split InMemoryFakeFlash to move the fixed-size buffer into the
  derived FakeFlashBuffer class.
- Support initializing FakeFlashBuffer to data provided at construction.
- Allow direct access to the underlying fake flash buffer for testing.
- Create utilities for working with byte arrays in byte_utils.h.

Change-Id: I90d33621cb91da079d7213fe7d33823494120e48
diff --git a/pw_kvs/public/pw_kvs/flash_memory.h b/pw_kvs/public/pw_kvs/flash_memory.h
index 5d8f558..93ee1eb 100644
--- a/pw_kvs/public/pw_kvs/flash_memory.h
+++ b/pw_kvs/public/pw_kvs/flash_memory.h
@@ -58,17 +58,19 @@
 
   // Erase num_sectors starting at a given address. Blocking call.
   // Address should be on a sector boundary.
-  // Returns: OK, on success.
-  //          TIMEOUT, on timeout.
-  //          INVALID_ARGUMENT, if address or sector count is invalid.
-  //          UNKNOWN, on HAL error
+  //
+  //                OK: success
+  // DEADLINE_EXCEEDED: timeout
+  //  INVALID_ARGUMENT: address is not sector-aligned
+  //      OUT_OF_RANGE: erases past the end of the memory
+  //
   virtual Status Erase(Address flash_address, size_t num_sectors) = 0;
 
   // Reads bytes from flash into buffer. Blocking call.
-  // Returns: OK, on success.
-  //          TIMEOUT, on timeout.
-  //          INVALID_ARGUMENT, if address or length is invalid.
-  //          UNKNOWN, on HAL error
+  //
+  //                OK: success
+  // DEADLINE_EXCEEDED: timeout
+  //      OUT_OF_RANGE: write does not fit in the flash memory
   virtual StatusWithSize Read(Address address, span<std::byte> output) = 0;
 
   StatusWithSize Read(Address address, void* buffer, size_t len) {
@@ -76,10 +78,12 @@
   }
 
   // Writes bytes to flash. Blocking call.
-  // Returns: OK, on success.
-  //          TIMEOUT, on timeout.
-  //          INVALID_ARGUMENT, if address or length is invalid.
-  //          UNKNOWN, on HAL error
+  //
+  //                OK: success
+  // DEADLINE_EXCEEDED: timeout
+  //  INVALID_ARGUMENT: address or data size are not aligned
+  //      OUT_OF_RANGE: write does not fit in the memory
+  //
   virtual StatusWithSize Write(Address destination_flash_address,
                                span<const std::byte> data) = 0;
 
@@ -150,6 +154,11 @@
                                               : alignment_bytes),
         permission_(permission) {}
 
+  // Creates a FlashPartition that uses the entire flash with its alignment.
+  constexpr FlashPartition(FlashMemory* flash)
+      : FlashPartition(
+            flash, 0, flash->sector_count(), flash->alignment_bytes()) {}
+
   FlashPartition(const FlashPartition&) = delete;
   FlashPartition& operator=(const FlashPartition&) = delete;