Chapter 2. API Reference
2.5.4 NVS Partition Generator Utility
Introduction
The utility nvs_flash/nvs_partition_generator/nvs_partition_gen.py creates a binary file based on key-value pairs pro-
vided in a CSV file. The binary file is compatible with NVS architecture defined in Non-Volatile Storage. This utility
is ideally suited for generating a binary blob, containing data specific to ODM/OEM, which can be flashed externally
at the time of device manufacturing. This allows manufacturers to generate many instances of the same application
firmware with customized parameters for each device, such as a serial number.
Prerequisites
To use this utility in encryption mode, install the following packages:
• cryptography package
All the required packages are included in requirements.txt in the root of the esp-idf directory.
CSV file format
Each line of a .csv file should contain 4 parameters, separated by a comma. The table below provides the description
for each of these parameters.
No. Pa-
ram-
e-
ter
Description Notes
1 Key Key of the data. The data can be accessed later from an appli-
cation using this key.
2 Type Supported values are file, data and namespace.
3 En-
cod-
ing
Supported values are: u8, i8, u16, i16, u32, i32, u64,
i64, string, hex2bin, base64 and binary. This
specifies how actual data values are encoded in the resulting bi-
nary file. The difference between the string and binary
encoding is that string data is terminated with a NULL
character, whereas binary data is not.
As of now, for the file
type, only hex2bin, base64,
string, and binary encoding
is supported.
4 Value Data value. Encoding and Value cells for the
namespace field type should be
empty. Encoding and Value of
namespace is fixed and is not
configurable. Any values in these
cells are ignored.
Note: The first line of the CSV file should be the column header and it is not configurable. Comments (if provided)
are allowed only as the first line of the CSV file, the following line then should always be the column header. Comments
should always start with the # symbol.
Below is an example dump of such a CSV file:
key,type,encoding,value <-- column header
namespace_name,namespace,, <-- First entry should be of type "namespace"
key1,data,u8,1
key2,file,string,/path/to/file
Note:
Espressif Systems 725
Submit Document Feedback
Release v4.4