Problem debugging esp32 / esp-prog with windows backslash in filenames

Hello,

when trying to debug an esp32dev with esp-prog I get the following error:

** Programming Started **
** Programming Started **
auto erase enabled
Error: couldn't open E:PlatformIOcorepackagesramework-arduinoespressif32 oolspartitionsoot_app0.bin
embedded:startup.tcl:480: Error: ** Programming Failed **
in procedure 'program_esp32'

however when I upload and run without debugging it works well:

Uploading .pio\build\esp32dev\firmware.bin
Open On-Chip Debugger  v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
none separate
adapter speed: 20000 kHz
esp32 interrupt mask on
** Programming Started **
** Filename:  {.pio\build\esp32dev\firmware.bin} **
auto erase enabled
wrote 204800 bytes from file .pio\build\esp32dev\firmware.bin in 2.474497s (80.825 KiB/s)
** Programming Finished **

platformio.ini:

[platformio]
core_dir = E:\PlatformIO\core

[env:esp32dev]
platform = https://github.com/platformio/platform-espressif32.git
framework = arduino
board = esp32dev
debug_tool = esp-prog
upload_protocol = esp-prog
debug_init_break = tbreak setup

It looks to me as if the backslash in the path is misinterpreted as escape character which cripples the path.
I tried with the latest dev versions.

Anything I can do?

regards,
Stefan

Can you upload the log again but put it in a tripple backticks environment (markdown ref)? The text in your post looks kinda corrupted.

Just edited my first post so it should look better now.

some additional info:
debugging works if I compile with build_type = debug and upload the firmware first.
When I then start debugging with F5 I still get the error that programing fails but since the firmware is already uploaded, JTAG debugging still works.

So it is really just an issue with the uploading of debug firmware that is built into the scripts that start the debug process.

regards,
Stefan

This is the real output?

yes, that’s the output.
It should be:
E:\PlatformIO\core\packages\framework-arduinoespressif32\tools\partitions
It seems that
\f from \framework,
\t from \tools
and
\b from \boot_app0.bin get misinterpreted somewhere …

regards,
Stefan

@valeros We might need some insight from you here for the esp32 upload scripts on this bug

Maybe it helps to know that the filename passed to program_esp32 is already wrong.
To test I inserted an additional 2 lines (binary scan and echo) in program_esp32:

# start programming phase
	echo "** Programming Started **"
	binary scan  $filename  H*  nameHex
	echo "** Filename = $nameHex **"
	if {[info exists address]} {
		set flash_args "$filename $address"
	} else {
		set flash_args "$filename"
	}

and it outputs

7b643a4461746569656e506c6174666f726d494f50726f6a6563747341726475436f756e74657250494f2e70696f0875696c6465737033326465760c69726d776172652e62696e7d

In e.g. “\boot” the \b is already changed to a 08 which is ASCI Backspace.

So the problem must already be when program_esp gets called.

I’m running into the same issue here. It results in not being able to upload before debugging and breakpoints not being stopped at.
I’ve also found that the filename gets mangled somewhere before esp32.cfg gets called, so the solution found in http://openocd.zylin.com/#/c/4083/ does not help, because at that point the filename is already wrong. Does anyone know which file or process calls the program_esp32 procedure, so we can fix it there?

Sorry, this is our bug and we have just fixed it. We plan to release PIO Core 4.0.3 this week.

Meanwhile, you can switch to the development version of PIO Core via opening PIO IDE Terminal and typing

pio upgrade --dev
1 Like