Tool to encode and decode Zephyrproject NVS filesystem.
Project description
znvs
Tools for manipulating Zephyr Non-Volatile Storage.
Requirements
- Python3
Installation
pip install znvs
Usage
Preparing NVS
from znvs.encoder import Encoder
example_data = {10: bytes.fromhex('1122334455'),
20: bytes.fromhex('A5A5A5A5')}
nvs_sector_size = 1024
nvs = Encoder(nvs_sector_size).dump(example_data)
print(nvs)
Output:
00000000: 11 22 33 44 55 FF FF FF A5 A5 A5 A5 FF FF FF FF ."3DU...........
00000010: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ................
00000020: 14 00 08 00 04 00 FF A3 0A 00 00 00 05 00 FF 24 ...............$
00000030: FF FF 00 00 00 00 FF 5C FF FF FF FF FF FF FF FF .......\........
Parsing NVS content
from znvs.decoder import Decoder
with open("../test/golden_samples/sample_00.bin", 'rb') as nvs_dump:
binary_content = nvs_dump.read()
content = Decoder(0x400).load(binary_content)
for key, value in content.items():
print(f"{key}:\n{hexdump(value, 'return')}")
Output:
1:
00000000: 11 22 33 44 55 66 77 88 ."3DUfw.
2:
00000000: A5 A5 A5 A5 A5 A5 5A 5A 5A 5A 5A 5A ......ZZZZZZ
3:
00000000: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ................
00000010: 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F ................
00000020: 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F !"#$%&'()*+,-./
00000030: 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>?
00000040: 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F @ABCDEFGHIJKLMNO
00000050: 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\]^_
00000060: 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F `abcdefghijklmno
00000070: 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F pqrstuvwxyz{|}~.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
znvs-0.1.1-py3-none-any.whl
(8.6 kB
view details)
File details
Details for the file znvs-0.1.1-py3-none-any.whl.
File metadata
- Download URL: znvs-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4b3be88a994aabcc07075729be37853eb8f9760cbb78739c40397176b0db107
|
|
| MD5 |
9442bf1aa6340eaa29d682853236483a
|
|
| BLAKE2b-256 |
e65569bf035b2d69566be63948224e79466dae98d35f78f3a4f2fe84bdc710a1
|