From 0002830c037e30fdac720c24e962b395904cfd83 Mon Sep 17 00:00:00 2001 From: Kyle Kearney Date: Tue, 29 Oct 2019 16:27:33 -0700 Subject: [PATCH] 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. --- features/storage/kvstore/tdbstore/TDBStore.cpp | 4 ++-- features/storage/kvstore/tdbstore/TDBStore.h | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/features/storage/kvstore/tdbstore/TDBStore.cpp b/features/storage/kvstore/tdbstore/TDBStore.cpp index a3ccc7a700..4e82dd3fe6 100644 --- a/features/storage/kvstore/tdbstore/TDBStore.cpp +++ b/features/storage/kvstore/tdbstore/TDBStore.cpp @@ -1504,8 +1504,8 @@ int TDBStore::get_flash_bounds_from_config(bd_addr_t *start_address, bd_size_t * if (*start_address == 0) { if (*size == 0) { - flash.deinit(); - return MBED_ERROR_INVALID_ARGUMENT; + //The block device will have all space from start address to the end of the flash + *size = flash.get_flash_size(); } *start_address = flash_end_address - *size; diff --git a/features/storage/kvstore/tdbstore/TDBStore.h b/features/storage/kvstore/tdbstore/TDBStore.h index 519891d923..a0603d37fd 100644 --- a/features/storage/kvstore/tdbstore/TDBStore.h +++ b/features/storage/kvstore/tdbstore/TDBStore.h @@ -301,10 +301,9 @@ public: /** * @brief Get the TDBStore flash bounds from the configured start address and size. - * Configured start address/size must not both be 0. * * @param[inout] start_address Configured TDBStore start address in flash. - * @param[inout] size Configured TDBStore size. + * @param[inout] size Configured TDBStore size. If 0, the size will be from the start address to the end of flash * * @returns MBED_SUCCESS Success. * MBED_ERROR_INVALID_ARGUMENT One of the arguments is NULL or both the configured start address and size are 0.