VS Arduino
>> >> ESP32 debugging won't start
https://www.visualmicro.com/forums/YaBB.pl?num=1583306309

Message started by Robert B on Mar 4th, 2020 at 7:18am

Title: ESP32 debugging won't start
Post by Robert B on Mar 4th, 2020 at 7:18am
Using VS 2019 Community and VM 1.2020.0301 with Segger J-link.

After upload with debug , VM stops and return to VS.

Output log:

Uploading 'Sketch2' to 'ESP32 Dev Module' using 'Segger J-Link'
Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:19)
Licensed under GNU GPL v2
For bug reports, read
     http://openocd.org/doc/doxygen/bugs.html
debug_level: 0
adapter speed: 3000 kHz
WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
****[vMicro]**** Uploading App :Error: type 'esp32' is missing virt2phys
** Programming Started **
auto erase enabled
wrote 8192 bytes from file C:\Users\rbj\AppData\Local\arduino15\packages\esp32\hardware\esp32\1.0.4/tools/partitions/boot_app0.bin in 3.288619s (2.433 KiB/s)
** Programming Finished **
****[vMicro]**** Uploading Bootloader :** Programming Started **
auto erase enabled
wrote 20480 bytes from file C:\Users\rbj\AppData\Local\arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/bin/bootloader_qio_40m.bin in 2.551492s (7.839 KiB/s)
** Programming Finished **
****[vMicro]**** Uploading Sketch :** Programming Started **
auto erase enabled
wrote 208896 bytes from file T:\TEMP\VMBuilds\Sketch2\esp32_esp32\Debug/Sketch2.ino.bin in 6.106277s (33.408 KiB/s)
** Programming Finished **
****[vMicro]**** Uploading Partitions :** Programming Started **
auto erase enabled
wrote 4096 bytes from file T:\TEMP\VMBuilds\Sketch2\esp32_esp32\Debug/Sketch2.ino.partitions.bin in 2.083649s (1.920 KiB/s)
** Programming Finished **
** Resetting Target **
shutdown command invoked
     The upload process has finished.


https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=verboscompile.txt ( 49 KB | 1 Download )

Title: Re: ESP32 debugging won't start
Post by Simon Hopkinson on Mar 4th, 2020 at 10:27am
Thanks for the information, can you confirm which actions were run here (looks to be Build & Upload)?

To start the Hardware Debugger you can run "Debug > Attach to Process" if the code has been uploaded to the board already, and to perform the upload and start debugging all in one action the "Debug > Start" option will do both actions.

Title: Re: ESP32 debugging won't start
Post by Robert B on Mar 4th, 2020 at 10:55am
I am using "Build&Upload" , when i try to "Debug > Attach to Process" i get a dialog from VS,
"Unable to start debugging, The value of miDebugerPath is invalid".
Program i starting , my led i blinking . :)


Title: Re: ESP32 debugging won't start
Post by Robert B on Mar 4th, 2020 at 11:07am
OpenOCD.log
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=Sketch2_ino_DebugOpenOCD.txt ( 1 KB | 1 Download )

Title: Re: ESP32 debugging won't start
Post by Simon Hopkinson on Mar 4th, 2020 at 11:08am
Thanks, I just wanted to be sure...

Could you enable the "vMicro > Upload > Verbose" option and then try the "Debug > Attach" again?

If you can attach the output from the Output "Micro Build" and "Debug" windows which will show what is happening more.

Also do you know what date/ and rough time you installed the current Visual Micro extension?

Title: Re: ESP32 debugging won't start
Post by Robert B on Mar 4th, 2020 at 12:09pm
Upload verbose
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=verboseupload.txt ( 6 KB | 3 Downloads )

Title: Re: ESP32 debugging won't start
Post by Simon Hopkinson on Mar 4th, 2020 at 12:24pm
Thanks, could you try with the "Debug > Attach" event which is failing, and attach the output again from that?

(The paths look correct in this upload log, and the Verbose option changed affects the logging for Debug and Upload)

Title: Re: ESP32 debugging won't start
Post by Robert B on Mar 4th, 2020 at 12:35pm
Compile and uploaded the program,
tried some times "Debug > Attach".
I get the same result with dialog.

Title: Re: ESP32 debugging won't start
Post by Simon Hopkinson on Mar 4th, 2020 at 12:47pm
If you close the error dialog after Debug > Attach, then go to the Output Window, and set the option at the top of the window to "Show Output From: Debug" there should be some output similar to the below:
[code]Starting: "C:\ProgramData\vmicro\tools\openocd-espressif-esp32-10.0.1\bin/openocd.exe" -d2 -l "{C:\Users\Simon\AppData\Local\Temp\VMBuilds\ESP32WROOMSC_JLINK_BLINK_GDB\esp32_esp32\Debug/ESP32WROOMSC_JLINK_BLINK_GDB.ino_DebugOpenOCD.log}" -s "C:\ProgramData\vmicro\tools\openocd-espressif-esp32-10.0.1/share/openocd/scripts/" -f "C:\ProgramData\vmicro\tools\openocd-espressif-esp32-10.0.1/share/openocd/scripts/interface/jlink.cfg" -c "set ESP32_RTOS none" -f "C:\ProgramData\vmicro\tools\openocd-espressif-esp32-10.0.1/share/openocd/scripts/board/esp-wroom-32.cfg" -c "init"
Starting: "C:\Users\Simon\AppData\Local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0/bin\xtensa-esp32-elf-gdb.exe" --interpreter=mi -ex "set remote hardware-watchpoint-limit 2" -ex "mon reset halt" -ex "flushregs" -ex "thb app_main" -ex "c"
"C:\ProgramData\vmicro\tools\openocd-espressif-esp32-10.0.1\bin/openocd.exe" exited with code 1 (0x1).[/code]

Again in the Output Window, "Show Output From: Micro Build" there should be some JSON output starting with "# MI Debugger Properties", which is also useful to help us see what is happening in the Debug > Attach event.

Title: Re: ESP32 debugging won't start
Post by Robert B on Mar 4th, 2020 at 12:54pm
ERROR: Launch properties formatting error: Access to the path 'T:\TEMP\VMBuilds\Sketch2\esp32_esp32\Debug\debugger_tmp.natvis' is denied.

# MI Debugger Properties
{
  "serverLaunchTimeout": 5000,
  "filterStdout": false,
  "filterStderr": true,
  "targetArchitecture": "arm",
  "stopAtEntry": false,
  "externalConsole": false,
  "MIMode": "gdb",
  "MIDebuggerServerAddress": "localhost:3333",
  "cwd": "T:\\TEMP\\VMBuilds\\Sketch2\\esp32_esp32\\Debug",
  "MIDebuggerPath": "{runtime.tools.arm-none-eabi-gcc.path}/bin\\arm-none-eabi-gdb.exe",
  "MIDebuggerArgs": "-ex \"set remote hardware-watchpoint-limit 2\" -ex \"mon reset halt\" -ex \"flushregs\" -ex \"thb app_main\" -ex \"c\"",
  "debugServerPath": "C:\\ProgramData\\vmicro\\tools\\openocd-0.10.0.20200213\\bin/openocd.exe",
  "debugServerArgs": "-d2 -l \"{T:\\TEMP\\VMBuilds\\Sketch2\\esp32_esp32\\Debug/Sketch2.ino_DebugOpenOCD.log}\" -s \"C:\\ProgramData\\vmicro\\tools\\openocd-0.10.0.20200213/scripts/\" -f \"interface/jlink.cfg\"",
  "program": "T:/TEMP/VMBuilds/Sketch2/esp32_esp32/Debug/Sketch2.ino.elf",
  "logging": {
    "moduleLoad": false,
    "trace": false,
    "engineLogging": false,
    "programOutput": false,
    "exceptions": false,
    "traceResponse": false
  }
}

Title: Re: ESP32 debugging won't start
Post by Simon Hopkinson on Mar 4th, 2020 at 1:03pm
Thanks, I am unsure about the permissions issue at the top, are you running VS as an Administrator?

The paths for the ESP32 Debugging are definitely wrong in the JSON output, there has been a minor update to resolve this.

To install you will need to manually uninstall Visual Micro from VS through the Extensions > Installed > Uninstall, and close VS to allow the uninstaller to kick in.

Then re-install it from the latest in the forum, and this should resolve the path issues you are experiencing for the debugger.

Title: Re: ESP32 debugging won't start
Post by Robert B on Mar 4th, 2020 at 2:05pm
Started VS as Admin, same answer without "ERROR".

# MI Debugger Properties
{
  "serverLaunchTimeout": 5000,
  "filterStdout": false,
  "filterStderr": true,
  "targetArchitecture": "arm",
  "stopAtEntry": false,
  "externalConsole": false,
  "MIMode": "gdb",
  "MIDebuggerServerAddress": "localhost:3333",
  "cwd": "T:\\TEMP\\VMBuilds\\Sketch2\\esp32_esp32\\Debug",
  "MIDebuggerPath": "{runtime.tools.arm-none-eabi-gcc.path}/bin\\arm-none-eabi-gdb.exe",
  "MIDebuggerArgs": "-ex \"set remote hardware-watchpoint-limit 2\" -ex \"mon reset halt\" -ex \"flushregs\" -ex \"thb app_main\" -ex \"c\"",
  "debugServerPath": "C:\\ProgramData\\vmicro\\tools\\openocd-0.10.0.20200213\\bin/openocd.exe",
  "debugServerArgs": "-d2 -l \"{T:\\TEMP\\VMBuilds\\Sketch2\\esp32_esp32\\Debug/Sketch2.ino_DebugOpenOCD.log}\" -s \"C:\\ProgramData\\vmicro\\tools\\openocd-0.10.0.20200213/scripts/\" -f \"interface/jlink.cfg\"",
  "program": "T:/TEMP/VMBuilds/Sketch2/esp32_esp32/Debug/Sketch2.ino.elf",
  "logging": {
    "moduleLoad": false,
    "trace": false,
    "engineLogging": false,
    "programOutput": false,
    "exceptions": false,
    "traceResponse": false
  },
  "visualizerFile": "T:\\TEMP\\VMBuilds\\Sketch2\\esp32_esp32\\Debug\\debugger_tmp.natvis",
  "showDisplayString": true
}

Uninstall VM.

Install lastest VM.

Almost started :) i can see debug tabs, but stop with error :
"Unable to start debugging. Failed to find thread 1 for break event"


Type "apropos word" to search for commands related to "word".
=cmd-param-changed,param="remote hardware-watchpoint-limit",value="2"
Register cache flushed.
Make hw breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
=cmd-param-changed,param="pagination",value="off"
0x400e812e in esp_pm_impl_waiti () at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/pm_esp32.c:492
[New Thread 1073463528]
[New Thread 1073447000]
[New Thread 1073467632]
[New Thread 1073455716]
[New Thread 1073445320]
[New Thread 1073446424]
=thread-selected,id="1"
[New Thread 1073464940]
The program '' has exited with code 42 (0x2a).








Title: Re: ESP32 debugging won't start
Post by Simon Hopkinson on Mar 4th, 2020 at 2:07pm
Thanks for persisting, and Ill investigate further as sure we had resolved this, and update as soon as possible...

Title: Re: ESP32 debugging won't start
Post by Robert B on Mar 4th, 2020 at 2:27pm
Thank you for your job,
waiting with great interest.

Title: Re: ESP32 debugging won't start
Post by Simon Hopkinson on Mar 4th, 2020 at 2:37pm
I see from a re-install the updates in the package don't seem to apply properly if previously installed, we will publish a full new version soon with these updates so they definitely install.

In the meantime there are two ways around this:-

1) Change the IDE Selection to Arduino 1.9 (beta) and this will use alternate configurations which will still work (can be configured the same as 1.6/1.8 for IDE locations etc...).  This can be setup by going to IDE > Configure IDE Locations, and changing the drop down to Arduino 1.9, and setting the paths as needed. Then ensure it is selected in the vMicro > IDE drop down.

OR

2) If you go to vMicro > General > Global Options, and at the bottom there is a property "Assembly Location".  If you take the path from this and open it in windows explorer.  Then navigate from there to "Micro Platforms\arduino16x\hardware\esp32". Put the two attached files into that folder (replace the existing ones). Then just restart Visual Studio and re-select the debugger and programmer options, and try attaching again.





https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=esp32.zip ( 3 KB | 1 Download )

Title: Re: ESP32 debugging won't start
Post by Robert B on Mar 5th, 2020 at 7:09am
in both cases I got the same error.

output :
...
Register cache flushed.
Make hw breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
=cmd-param-changed,param="pagination",value="off"
0x400e812e in esp_pm_impl_waiti () at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/pm_esp32.c:492
[New Thread 1073463528]
[New Thread 1073447000]
[New Thread 1073467632]
[New Thread 1073455716]
[New Thread 1073445320]
[New Thread 1073446424]
=thread-selected,id="1"
[New Thread 1073464940]
The program '' has exited with code 42 (0x2a).

Title: Re: ESP32 debugging won't start
Post by Simon Hopkinson on Mar 5th, 2020 at 10:53am
Thanks for the additional information.

I have noticed the OpenOCD Version listed in your output is from (2019-11-14-14:19), but the one we download is from (2019-03-13-09:57), which is quite a difference... do you have IDF Tools installed on your machine?

Can you rename the folder "C:\ProgramData\VMicro\tools\openocd-espressif-esp32-10.0.1" (e.g. put an x at the start), and then try attaching the debugger again?  (This should trigger a fresh download of the tool to the same location)


Title: Re: ESP32 debugging won't start
Post by Robert B on Mar 6th, 2020 at 9:10am
Now it works.

Rename folder, VM download lasted version and debugging starts.  :)

Thanks for all yours effort.


VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.