From c44f15441fed6a5b3fec24fd99923b402df108eb Mon Sep 17 00:00:00 2001 From: Shivani Tipnis Date: Tue, 13 Nov 2018 17:07:14 +0530 Subject: [PATCH] Closes https://github.com/espressif/esp-idf/issues/2472 --- components/nvs_flash/nvs_partition_generator/README.rst | 2 ++ .../nvs_partition_generator/nvs_partition_gen.py | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/components/nvs_flash/nvs_partition_generator/README.rst b/components/nvs_flash/nvs_partition_generator/README.rst index e0103b829..f6775179b 100644 --- a/components/nvs_flash/nvs_partition_generator/README.rst +++ b/components/nvs_flash/nvs_partition_generator/README.rst @@ -166,6 +166,8 @@ A sample CSV file is provided with the utility:: python nvs_partition_gen.py --input sample_singlepage_blob.csv --output partition_single_page.bin --size 0x3000 --version v1 +.. note:: *Minimum NVS Partition Size needed is 0x3000 bytes.* + .. note:: *When flashing the binary onto the device, make sure it is consistent with the application's sdkconfig.* Caveats diff --git a/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py b/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py index a4d5f78d5..40159cd88 100755 --- a/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py +++ b/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py @@ -593,7 +593,7 @@ class InsufficientSizeError(RuntimeError): to accomodate the data in the given csv file """ def __init__(self, e): - super(InsufficientSizeError, self).__init__(e) + super(InsufficientSizeError, self).__init__(e) def nvs_open(result_obj, input_size): """ Wrapper to create and NVS class object. This object can later be used to set key-value pairs @@ -691,13 +691,13 @@ encrypt_mode=None, key_file=None, version_no=None, print_arg_str=None, print_enc input_size = int(input_size, 0) if input_size % 4096 !=0: - sys.exit("Size of partition (must be multiple of 4096)") + sys.exit("Size of partition must be multiple of 4096") # Update size as a page needs to be reserved of size 4KB input_size = input_size - Page.PAGE_PARAMS["max_size"] - if input_size == 0: - sys.exit("Size parameter is insufficient.") + if input_size < (2 * Page.PAGE_PARAMS["max_size"]): + sys.exit("Minimum NVS partition size needed is 0x3000 bytes.")