esp-nvs-partition-tool
ESP-IDF compatible NVS (Non-Volatile Storage) partition table parser and generator inspired by esp-idf-nvs-partition-gen.
This library and CLI tool allows you to parse and generate NVS partition binary files from CSV files, following the ESP-IDF NVS partition format specification.
TODO
- Encryption support (planned for future release)
CSV Format
The CSV file must have exactly four columns:
key,type,encoding,value
Entry Types
-
namespace - Defines a namespace
- Encoding and value must be empty
- Example:
my_namespace,namespace,,
-
data - Raw data entry
- Valid encodings:
u8,i8,u16,i16,u32,i32,u64,i64,string,hex2bin,base64 - Example:
my_key,data,u32,12345
- Valid encodings:
-
file - Read value from a file
- Valid encodings:
string,hex2bin,base64,binary - Value should be the file path (relative to CSV file)
- Example:
my_blob,file,binary,data.bin
- Valid encodings:
Example CSV
key,type,encoding,value
namespace_one,namespace,,
example_u8,data,u8,100
example_i8,data,i8,-100
example_string,data,string,Hello World
example_blob,data,hex2bin,AABBCCDDEE
namespace_two,namespace,,
config,file,binary,config.bin
CLI Usage
Generate NVS Partition Binary
The size can be specified in decimal or hexadecimal (with 0x prefix):
# Generate 16KB partition (decimal)
# Generate 16KB partition (hexadecimal)
Parse NVS Partition Binary to CSV
Example:
# Parse a partition binary back to CSV
Library Usage
Add to your Cargo.toml:
[]
= "0.1.0"
Example usage:
use NvsPartition;
References
- ESP-IDF NVS Partition Generator Documentation
- ESP-IDF NVS Flash Documentation
- esp-idf-part - Reference implementation for partition tables