From fb31788504f035b9577ce230eee4e49ddc7b3baf Mon Sep 17 00:00:00 2001 From: Shivani Tipnis Date: Mon, 8 Oct 2018 11:11:56 +0530 Subject: [PATCH] nvs_part_gen: Add changes to partition size input --- .../nvs_partition_generator/README.rst | 2 +- .../nvs_partition_gen.py | 23 +++++++++---------- tools/mass_mfg/docs/README.rst | 4 ++-- tools/mass_mfg/mfg_gen.py | 5 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/components/nvs_flash/nvs_partition_generator/README.rst b/components/nvs_flash/nvs_partition_generator/README.rst index aa7a945c2..f0c6d6623 100644 --- a/components/nvs_flash/nvs_partition_generator/README.rst +++ b/components/nvs_flash/nvs_partition_generator/README.rst @@ -123,7 +123,7 @@ A sample CSV file is provided with the utility:: +------------------------+----------------------------------------------------------------------------------------------+ | output | Path to output converted binary file. Will use stdout if omitted | +------------------------+----------------------------------------------------------------------------------------------+ -| size | Size of NVS Partition in KB. Eg. 12KB | +| size | Size of NVS Partition in hex (must be multiple of 4096). Eg. 0x1000 | +------------------------+----------------------------------------------------------------------------------------------+ | --version {v1,v2} | Set version. Default: v2 | +-------------------------------+---------------------------------------------------------------------------------------+ 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 a1cc81a65..2b11877ca 100755 --- a/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py +++ b/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py @@ -179,7 +179,7 @@ class Page(object): data_input = byte_arr - + if sys.version_info[0] < 3: data_input = binascii.hexlify(bytearray(data_input)) else: @@ -214,7 +214,6 @@ class Page(object): data_val = str(data_bytes) + (init_data_val * (data_len_needed - len(data_bytes))) encr_data_ret = self.encrypt_entry(data_val, tweak_val, encr_key_input) - #print("\n<<<\n") encr_data_to_write = encr_data_to_write + encr_data_ret # Update values for encrypting next set of data bytes start_idx = end_idx @@ -233,7 +232,7 @@ class Page(object): encr_data[0:len(encr_data_ret)] = encr_data_ret else: encr_data[0:len(encr_data_ret)] = encr_data_ret - + data = encr_data data_offset = Page.FIRST_ENTRY_OFFSET + (Page.SINGLE_ENTRY_SIZE * self.entry_num) @@ -311,7 +310,7 @@ class Page(object): if not sys.version_info[0] < 3: if type(data_chunk) == str: data_chunk = codecs.encode(data_chunk, 'utf8') - + crc = zlib.crc32(data_chunk, 0xFFFFFFFF) struct.pack_into('