Просмотр исходного кода

Closes https://github.com/espressif/esp-idf/issues/2472

Shivani Tipnis 7 лет назад
Родитель
Сommit
c44f15441f

+ 2 - 0
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
     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.*
 .. note::  *When flashing the binary onto the device, make sure it is consistent with the application's sdkconfig.*
 
 
 Caveats
 Caveats

+ 4 - 4
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
     to accomodate the data in the given csv file
     """
     """
     def __init__(self, e):
     def __init__(self, e):
-       super(InsufficientSizeError, self).__init__(e)
+        super(InsufficientSizeError, self).__init__(e)
 
 
 def nvs_open(result_obj, input_size):
 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
     """ 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)
         input_size = int(input_size, 0)
 
 
         if input_size % 4096 !=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
         # Update size as a page needs to be reserved of size 4KB
         input_size = input_size - Page.PAGE_PARAMS["max_size"]
         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.")