Hi all -
I'm still trying to figure out how to do the serialization of our ESP32-based products. I have to load each unit with a unique MAC address and serial number assigned by us (can't use the MAC supplied through Espressif).
A couple questions about partitions:
1. I notice that the first partition in the default table is nvs, and begins at offset 0x9000. Is the space below that reserved, or can I use it?
2. If I can't use this space, I assume I can make the nvs partition smaller and create another partition to use that recovered space?
2. I've read the pages on creating a partition .bin file. How does one go about flashing this file (to load just one partition)?
Thanks...
(resolved) creating custom partition
(resolved) creating custom partition
Last edited by mzimmers on Wed Nov 14, 2018 9:38 pm, edited 1 time in total.
Re: creating custom partition
Its not exactly that nvs is first partition. Not all partitions are included in partitions.csv file. This is default single app partition table:
and here is part of output from make command:
As you can see bootloader partition is loaded from address 0x1000 and partition table from 0x8000, but none is included in partitions.csv. Address 0x0000-0x1000 is system reserved.
2. Assuming that you will use flash encryption on your final product then minimum nvs size is 4096 bytes:
https://docs.espressif.com/projects/esp ... -partition
3. You can use flash download tool or from cli use proper command: make flash partition_table, make flash_app, make flash bootloader or:
With this command you can flash as many partitions as you want/need and you can control start address to flash.
Code: Select all
# Espressif ESP32 Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 1M,
Code: Select all
0x1000 /home/imper/examples/ble_mesh_provisioner/build/bootloader/bootloader.bin
0x10000 /home/imper/examples/ble_mesh_provisioner/build/bt_mesh_provisioner.bin
0x8000 /home/imper/examples/ble_mesh_provisioner/build/partitions_singleapp.bin
2. Assuming that you will use flash encryption on your final product then minimum nvs size is 4096 bytes:
https://docs.espressif.com/projects/esp ... -partition
3. You can use flash download tool or from cli use proper command: make flash partition_table, make flash_app, make flash bootloader or:
Code: Select all
python /home/imper/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 /home/imper/examples/ble_mesh_provisioner/build/bootloader/bootloader.bin 0x10000 /home/imper/examples/ble_mesh_provisioner/build/bt_mesh_provisioner.bin 0x8000 /home/imper/examples/ble_mesh_provisioner/build/partitions_singleapp.bin
Re: creating custom partition
So, if my partition structure looks like this currently:
I should be able to reduce nvs to 0x2000 bytes, giving me room for a new partition at 0xa000, right?
And, I notice your esptool.py example flashes 3 partitions. If I only wish to flash one partition, can I do so, or will it erase the other existing partitions?
Code: Select all
I (57) boot: 0 nvs WiFi data 01 02 00009000 00004000
I (64) boot: 1 otadata OTA data 01 00 0000d000 00002000
I (72) boot: 2 phy_init RF data 01 01 0000f000 00001000
I (79) boot: 3 factory factory app 00 00 00010000 00100000
I (87) boot: 4 ota_0 OTA app 00 10 00110000 00100000
I (94) boot: 5 ota_1 OTA app 00 11 00210000 00100000
And, I notice your esptool.py example flashes 3 partitions. If I only wish to flash one partition, can I do so, or will it erase the other existing partitions?
Re: creating custom partition
Probably someone more experienced can confirm my answer but from my experience i can say yes, you can resize nvs to 0x2000 and add another partition.
As long as binary file size that you want to flash is smaller than partition size you can safely flash it(1 or 2 or 3 etc), but if binary is bigger than partition size then next partition will be overlapped and corrupted.I notice your esptool.py example flashes 3 partitions. If I only wish to flash one partition, can I do so, or will it erase the other existing partitions?
Re: creating custom partition
Thanks for the answers. I reduced my nvs partition to 0x1000 bytes. When I try to call nvs_set_blob() for a write of 0x3fc bytes, I get an error ESP_ERR_NVS_VALUE_TOO_LONG. I didn't get this error when my nvs partition was 0x2000 bytes. I guess there's a substantial amount of overhead associated with using the NVS library.
Anyway, it's no big deal. I changed my nvs partition to 0x3000 bytes and everything seems happy now. Thanks for the help.
Anyway, it's no big deal. I changed my nvs partition to 0x3000 bytes and everything seems happy now. Thanks for the help.
Who is online
Users browsing this forum: MicroController and 81 guests