From 3ef04db1a3333bc46706a174a2605f4dae44b923 Mon Sep 17 00:00:00 2001 From: Kyle Kearney Date: Wed, 30 Oct 2019 16:09:28 -0700 Subject: [PATCH] TDBStore: Increase min pages to 14 Increase minimum page count from 10 to 14 based on further experiments with features-storage-tests-kvstore-static_tests. --- .../storage/kvstore/conf/filesystem/mbed_lib.json | 2 +- features/storage/kvstore/conf/kv_config.cpp | 12 ++++++------ .../storage/kvstore/conf/tdb_external/mbed_lib.json | 2 +- .../storage/kvstore/conf/tdb_internal/mbed_lib.json | 2 +- features/storage/kvstore/tdbstore/TDBStore.h | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/features/storage/kvstore/conf/filesystem/mbed_lib.json b/features/storage/kvstore/conf/filesystem/mbed_lib.json index 1758242de7..836da52074 100644 --- a/features/storage/kvstore/conf/filesystem/mbed_lib.json +++ b/features/storage/kvstore/conf/filesystem/mbed_lib.json @@ -2,7 +2,7 @@ "name": "storage_filesystem", "config": { "rbp_internal_size": { - "help": "Default is the larger of the last 2 sectors or last 10 pages of flash.", + "help": "Default is the larger of the last 2 sectors or last 14 pages of flash.", "value": "0" }, "internal_base_address": { diff --git a/features/storage/kvstore/conf/kv_config.cpp b/features/storage/kvstore/conf/kv_config.cpp index cfa2f96cb2..d19afa62cf 100644 --- a/features/storage/kvstore/conf/kv_config.cpp +++ b/features/storage/kvstore/conf/kv_config.cpp @@ -184,12 +184,12 @@ int _calculate_blocksize_match_tdbstore(BlockDevice *bd) bd_size_t number_of_sector = size / erase_size; bd_size_t number_of_page = size / page_size; if (number_of_sector < TDBStore::STORE_SECTORS) { - tr_warning("KV Config: There are less than two sectors - TDBStore will not work."); + tr_warning("KV Config: There are less than %d sectors - TDBStore will not work.", TDBStore::STORE_SECTORS); return -1; } if (number_of_page < TDBStore::STORE_PAGES) { - tr_warning("KV Config: There are less than ten pages sectors - TDBStore will not work."); + tr_warning("KV Config: There are less than %d pages - TDBStore will not work.", TDBStore::STORE_PAGES); return -1; } @@ -592,9 +592,9 @@ int _create_internal_tdb(BlockDevice **internal_bd, KVStore **internal_tdb, bd_s return MBED_ERROR_FAILED_OPERATION ; } - //Check if TDBStore has at least 2 sectors or 10 pages. + //Check if TDBStore has at least 2 sectors or 14 pages. if (_calculate_blocksize_match_tdbstore(*internal_bd) != MBED_SUCCESS) { - tr_error("KV Config: Can not create TDBStore with less then 2 sectors or 10 pages."); + tr_error("KV Config: Can not create TDBStore with less then %d sectors or %d pages.", TDBStore::STORE_SECTORS, TDBStore::STORE_PAGES); return MBED_ERROR_INVALID_ARGUMENT; } @@ -760,9 +760,9 @@ int _storage_config_tdb_external_common() return MBED_ERROR_FAILED_OPERATION ; } - //Check that there is at least 2 sectors for the external TDBStore + //Check that there is at least 2 sectors or 14 pages for the external TDBStore if (_calculate_blocksize_match_tdbstore(kvstore_config.external_bd) != MBED_SUCCESS) { - tr_error("KV Config: Can not create TDBStore with less then 2 sectors or 10 pages."); + tr_error("KV Config: Can not create TDBStore with less then 2 sectors or 14 pages."); return MBED_ERROR_INVALID_SIZE; } diff --git a/features/storage/kvstore/conf/tdb_external/mbed_lib.json b/features/storage/kvstore/conf/tdb_external/mbed_lib.json index 97486e841a..af9b80ec5d 100644 --- a/features/storage/kvstore/conf/tdb_external/mbed_lib.json +++ b/features/storage/kvstore/conf/tdb_external/mbed_lib.json @@ -2,7 +2,7 @@ "name": "storage_tdb_external", "config": { "rbp_internal_size": { - "help": "Default is the larger of the last 2 sectors or last 10 pages of flash.", + "help": "Default is the larger of the last 2 sectors or last 14 pages of flash.", "value": "0" }, "internal_base_address": { diff --git a/features/storage/kvstore/conf/tdb_internal/mbed_lib.json b/features/storage/kvstore/conf/tdb_internal/mbed_lib.json index 06f4cd43e9..4289423c38 100644 --- a/features/storage/kvstore/conf/tdb_internal/mbed_lib.json +++ b/features/storage/kvstore/conf/tdb_internal/mbed_lib.json @@ -2,7 +2,7 @@ "name": "storage_tdb_internal", "config": { "internal_size": { - "help": "Size of the FlashIAP block device. Default size will be the larger of the last 2 sectors or last 10 pages of flash.", + "help": "Size of the FlashIAP block device. Default size will be the larger of the last 2 sectors or last 14 pages of flash.", "value": "0" }, "internal_base_address": { diff --git a/features/storage/kvstore/tdbstore/TDBStore.h b/features/storage/kvstore/tdbstore/TDBStore.h index a0603d37fd..48c94eefb3 100644 --- a/features/storage/kvstore/tdbstore/TDBStore.h +++ b/features/storage/kvstore/tdbstore/TDBStore.h @@ -37,12 +37,12 @@ public: static const uint32_t RESERVED_AREA_SIZE = 64; - // Use the last 2 sectors or 10 pages of flash for the TDBStore by default (whichever is larger) + // Use the last 2 sectors or 14 pages of flash for the TDBStore by default (whichever is larger) // For each area: must be a minimum of 1 page of reserved and 2 pages for master record /** Minimum number of internal flash sectors required for TDBStore */ static const int STORE_SECTORS = 2; /** Minimum number of internal flash pages required for TDBStore */ - static const int STORE_PAGES = 10; + static const int STORE_PAGES = 14; /** * @brief Class constructor