To perform OTA, we need a partition table with at least two partitions.
Assignment steps#
In this first assignment, we will:
- Check the current partition table loaded in your module
- Change it to a different default partition table
- Check the new partition table
Check the current partiton table#
To check the current partition table you need to
- Read the flash and dump the partition table in a
.bin
file - Convert the
.bin
file to a readable format
Read the flash#
To read the flash we can use esptool.py
:
esptool.py -p <YOUR-PORT> read_flash 0x8000 0x1000 partition_table.bin
where <YOUR-PORT>
is the same port you use to flash the device (e.g. /dev/tty.usbmodem1131101
or COM25
).
This creates a partition_table.bin
file.
Convert the partition table#
To convert it to a readable format, we can use gen_esp32part.py
.
python $IDF_PATH/components/partition_table/gen_esp32part.py partition_table.bin
You should get this output:
Parsing binary partition input...
Verifying table...
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,24K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
coredump,data,coredump,0x110000,64K,
Change partition table#
Now we change the partition table, using the most appropriate default option selectable via menuconfig
.
- Open menuconfig:
> ESP-IDF: SDK Configuration Editor (menuconfig)
→Partition Table
→Factory app, two OTA definitions
Since we’re now using two OTAs, the default flash configuration of 2MB is not enough, so we need to change it too
- Open menuconfig:
> ESP-IDF: SDK Configuration Editor (menuconfig)
→Serial Flasher Config
→Flash Size
→4MB
Check the new partition table#
Let’s do the same steps as before
esptool.py -p <YOUR-PORT> read_flash 0x8000 0x1000 partition_table.bin
python $IDF_PATH/components/partition_table/gen_esp32part.py partition_table.bin
And you’ll get
Parsing binary partition input...
Verifying table...
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,16K,
otadata,data,ota,0xd000,8K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
ota_0,app,ota_0,0x110000,1M,
ota_1,app,ota_1,0x210000,1M,
Conclusion#
In this assignment you changed the partition table from Single factory app, no ota
to the default Factory app, two ota definitions
.
Both of these partition table scheme are provided as default values from ESP-IDF.
In the next assignment you will create a custom partition table.
Next step: assignment 4.2