You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow provisioning ESP32 nvs partition when building
Adds the option to provision nvs partition data at build time for the esp32 platform. If the file
`nvs_partition.csv` is found in the AtomVM/src/platforms/esp32 directory when building; the nvs
partition will be created and added to the `idf.py flash` task as well as to the configuration for
the mkimage.sh script in the build directory. An example file is provided and `nvs_partition.csv`
is added to `.gitignore` to prevent accidentally pushing secrets to remote repositories.
Signed-off-by: Winford <[email protected]>
Copy file name to clipboardExpand all lines: doc/src/build-instructions.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -298,6 +298,68 @@ the partition table has not been altered.
298
298
299
299
To build a single binary image file see [Building a Release Image](#building-a-release-image), below.
300
300
301
+
#### NVS Partition Provisioning
302
+
303
+
For streamlining deployment of images for an environment developers may pre-provision NVS partition
304
+
data. This is done by creating a file in the AtomVM/src/platforms/esp32 directory named
305
+
`nvs_partition.csv`, an example called `nvs_partition.csv-example` is provided in the same
306
+
directory. If this file exists it will be added to the `idf.py flash` task and the mkimage.sh
307
+
script in the build directory. This is a more detailed example with explanations of the
308
+
structure:
309
+
310
+
```{csv}
311
+
key,type,encoding,value
312
+
network,namespace,,
313
+
ssid,data,binary,"NETWORK_NAME"
314
+
psk,data,binary,"PASSWORD"
315
+
settings,namespace,,
316
+
feature0,data,binary,"1"
317
+
extra_feature,data,binary,"0"
318
+
token,file,binary,/path/to/file
319
+
```
320
+
321
+
Let's break this down line by line:
322
+
323
+
```csv
324
+
key,type,encoding,value
325
+
```
326
+
This is the header describing the columns. It is important that there is no whitespace at the end of each line
327
+
and none separating the commas (`,`) throughout this file.
328
+
329
+
```csv
330
+
network,namespace,,
331
+
```
332
+
The first entry should have a "key" name and have type "namespace". The namespaces are the same
333
+
used to look up the keys with
334
+
[esp:nvs_get_binary/2 (or /3)](./apidocs/erlang/eavmlib/esp.md#nvs_get_binary2). Note that the
335
+
`encoding` and `value` are empty.
336
+
337
+
```csv
338
+
ssid,data,binary,"NETWORK_NAME"
339
+
...
340
+
```
341
+
The keys must use encoding type `binary` as this is the only type currently supported by AtomVM.
342
+
343
+
```csv
344
+
settings,namespace,,
345
+
...
346
+
```
347
+
Multiple namespaces may be used for separation, followed by their keys.
348
+
349
+
```csv
350
+
token,file,binary,/path/to/file
351
+
```
352
+
External file contents may be included
353
+
354
+
The initial values flashed to the `nvs` partition may be changed by applications using
355
+
[esp:nvs_put_binary/3](./apidocs/erlang/eavmlib/esp.md#nvs_put_binary3). If you wish to make
356
+
changes to the partition data and re-flash without rebuilding and flashing the entire AtomVM build
357
+
you may delete the generated `build/nvs.bin` file and run `idf.py nvs-flash`, this will regenerate
358
+
and flash the `nvs` partition.
359
+
360
+
For more information about the format of this file see Espressif's
361
+
[documentation for the NVS generator file format](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/storage/nvs_partition_gen.html#csv-file-format).
362
+
301
363
### Running tests for ESP32
302
364
303
365
Tests for ESP32 are run on the desktop (or CI) using qemu.
0 commit comments