I have done some digging into this and I think I know what is happening, but I’m not sure where the error belongs:
When we tell platformio to upload the binary flash images it is invoked via the espressif builder python code:
./platforms/espressif32/builder/main.py
This ultimately calls the openocd libraries via a defined function called “program_esp” in esp_common.cfg
./packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg
When it invokes this call it pads the filename with braces:
963: “program_esp {{$SOURCE}} %s verify”
976: “program_esp {{%s}} %s verify”
I think this is to handle the case when a filename has spaces in it, although it only does it for the openocd case. For the other cases it just puts quotes around the filename.
The program_esp code then takes this file and adds quotes to it for the same reason - possible spaces in the filename.
407 echo "** program_esp input args <$args> **"
405
406 # Place quotes around the path in case it contains spaces
407 set filename "\"$filename\""
This has the effect of making the braces a part of the filename rather than a shell variable expansion.
adapter speed: 5000 kHz
** program_esp input args <0x10000 verify> **
** Programming Started **
You can enable skip_loaded to increase download speed.
Error: couldn’t open {.pio/build/octo/firmware.bin}
embedded:startup.tcl:1869: Error: ** Programming Failed **
Traceback (most recent call last):
File “/home/euan/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg”, line 534, in program_esp
program_error {** Programming Failed } 0
File “embedded:startup.tcl”, line 1869, in program_error
error { Programming Failed **}
*** [upload] Error 1
If we remove either or both of these, then it works as expected.
adapter speed: 5000 kHz
** program_esp input args <0x10000 verify> **
** Programming Started **
You can enable skip_loaded to increase download speed.
** Programming Finished in 5552 ms **
** Verify Started **
** Verify OK **
Looking in the github repos, both of these have been in the code for several years, so I must assume it has never worked or I am doing something very wrong.
For reference, my platform version is fairly new from the pioarduino project:
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.34/platform-espressif32.zip