partition table offset for flashing is apparently wrong
See original GitHub issueFrom my understanding, the partition table on ESP32 is supposed to be 0x8000 based on the documentation:
A single ESP32’s flash can contain multiple apps, as well as many different kinds of data (calibration data, filesystems, parameter storage, etc). For this reason a partition table is flashed to offset 0x8000 in the flash.
In build/main.py:119 and the following cases for each framework, the flash address for partition table is 0x4000.
When flashing in verbose I can see the line calling esptool:
pio run -v -t upload
[...]
"/usr/bin/python2" "/home/bleader/.platformio/packages/tool-esptoolpy/esptool.py" --chip esp32 --port "/dev/ttyUSB0" --baud 115200 write_flash -z --flash_mode dio --flash_freq 80m 0x1000 "/home/bleader/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader.bin" 0x4000 "/home/bleader/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/partitions_singleapp.bin" 0x10000 .pioenvs/esp32dev/firmware.bin
[...]
This leads to something like:
user code not found
I say something like because my following attempt was to flash manually calling the same line, but using 0x8000 for partition table:
"/usr/bin/python2" "/home/bleader/.platformio/packages/tool-esptoolpy/esptool.py" --chip esp32 --port "/dev/ttyUSB0" --baud 115200 write_flash -z --flash_mode dio --flash_freq 80m 0x1000 "/home/bleader/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader.bin" 0x8000 "/home/bleader/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/partitions_singleapp.bin" 0x10000 .pioenvs/esp32dev/firmware.bin
This worked, but now, when flashing using pio run -t upload partition table do not change, and the one at 0x8000 isn’t erased, so code is still executed fine.
So any module with a matching partition table data written at 0x8000 won’t exhibit the issue anymore. Which makes this a pretty low priority issue I guess, and explains why it wasn’t seen before, I just faced it as I used a brand new dev board directly with platformio command line without any other test prior to it.
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
Hi @svofski ! I’ve added a way to override the default offsets. Here is an example with a custom value for partition table
If there is no custom value is
platformio.ini
, then we fall back to the value specified in the sdk configuration. Would be great if you could retest with the upstream version of the platform. Thanks!To someone stumbling upon this while frustrated by the partition table offset issue, add this clumsy script the project dir and add a line to platformio.ini like so
This however would be a trivial fix here, where all information is already loaded, you just need to replace the hardcoded address: https://github.com/platformio/platform-espressif32/blob/19cb8eb6d4c8ee4a52a5e8cc3884e93e768ad97c/builder/frameworks/espidf.py#L1069
Thanks for your attention!