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.
pull/11629/head
Kyle Kearney 2019-10-29 16:27:33 -07:00
parent 9d414316da
commit 0002830c03
2 changed files with 3 additions and 4 deletions

View File

@ -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;

View File

@ -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.