From: Angus Gratton Date: Mon, 24 Sep 2018 03:53:29 +0000 (+0800) Subject: Merge branch 'feature/nvs_util_backport' into 'master' X-Git-Tag: v3.2-beta1~119 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d50427e877224edcc3b45b83d33a8e94c7cdba0;p=esp-idf Merge branch 'feature/nvs_util_backport' into 'master' nvs_util: Add changes for utility to support old and new multipage blob See merge request idf/esp-idf!3270 --- 4d50427e877224edcc3b45b83d33a8e94c7cdba0 diff --cc components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py index cd07d7f41c,8d78b908e7..4446d084fc --- a/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py +++ b/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py @@@ -220,13 -239,18 +241,18 @@@ class Page(object) # Set size of data datalen = len(data) - if encoding == "string": - if datalen > Page.PAGE_PARAMS["max_blob_size"]: + if version == Page.VERSION1: + if datalen > Page.PAGE_PARAMS["max_old_blob_size"]: raise InputError("%s: Size exceeds max allowed length." % key) + if version == Page.VERSION2: + if encoding == "string": + if datalen > Page.PAGE_PARAMS["max_new_blob_size"]: + raise InputError("%s: Size exceeds max allowed length." % key) + # Calculate no. of entries data will require rounded_size = (datalen + 31) & ~31 - data_entry_count = rounded_size / 32 + data_entry_count = rounded_size // 32 total_entry_count = data_entry_count + 1 # +1 for the entry header # Check if page is already full and new page is needed to be created right away