Skip to content

Commit b4f7ef6

Browse files
author
Kyle Kearney
committed
TDBStore: remove get_flash_bounds input constraint
Handle the case where the entirety of flash (size = 0) is required for a flash memory starting at address 0, instead of erroring out.
1 parent f40f4ba commit b4f7ef6

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

features/storage/kvstore/tdbstore/TDBStore.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,8 +1529,8 @@ int TDBStore::get_flash_bounds_from_config(bd_addr_t *start_address, bd_size_t *
15291529

15301530
if (*start_address == 0) {
15311531
if (*size == 0) {
1532-
flash.deinit();
1533-
return MBED_ERROR_INVALID_ARGUMENT;
1532+
//The block device will have all space from start address to the end of the flash
1533+
*size = flash.get_flash_size();
15341534
}
15351535

15361536
*start_address = flash_end_address - *size;

features/storage/kvstore/tdbstore/TDBStore.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,9 @@ class TDBStore : public KVStore {
301301

302302
/**
303303
* @brief Get the TDBStore flash bounds from the configured start address and size.
304-
* Configured start address/size must not both be 0.
305304
*
306-
* @param[inout] start_address Configured TDBStore start address in flash.
307-
* @param[inout] size Configured TDBStore size.
305+
* @param[inout] start_address Configured TDBStore start address in flash.
306+
* @param[inout] size Configured TDBStore size. If 0, the size will be from the start address to the end of flash
308307
*
309308
* @returns MBED_SUCCESS Success.
310309
* MBED_ERROR_INVALID_ARGUMENT One of the arguments is NULL or both the configured start address and size are 0.

0 commit comments

Comments
 (0)