VS Arduino
Visual Micro >> Hardware Debugging (GDB, GDB WiFi, GDB Stub) >> ESP32-DevkitS module support
https://www.visualmicro.com/forums/YaBB.pl?num=1636976592

Message started by Dak on Nov 15th, 2021 at 11:43am

Title: ESP32-DevkitS module support
Post by Dak on Nov 15th, 2021 at 11:43am
Hello,
please do you have some experience with ESP32-DevkitS module debug? I tried ESP32-Devkitc-V4 and it works well with ESP32-Prog debugger. But with ESP32-DevkitS module (I put inside ESP32-WROOM-32E 16MB submodule) I cant get debug working. There is no problem to flash DevkitS.
Thank you very much. David

Title: Re: ESP32-DevkitS module support
Post by Simon@Visual Micro on Nov 15th, 2021 at 11:53am
Thanks for the report.

Are you flashing the board via the ESP-PROG module using a the Enable Programmer option?

Title: Re: ESP32-DevkitS module support
Post by Dak on Nov 15th, 2021 at 12:50pm
Thanks very much for your prompt answer and sorry for my delay... I flash the board using COM connection directly to Devkitc or Devkits module. It works properly with both modules even there are different (4MB vs. 16MB) wroom submodules.
So I use No Programmer option on Visual Micro.

Title: Re: ESP32-DevkitS module support
Post by Dak on Nov 15th, 2021 at 12:59pm
There is one more difference between submodules... On DevkitC there is version ESP-WROOM-32D and on DevkitS I put ESP-WROOM-32E (new one recommended for develepment). Maybe debugger dont communicate with 32E version? But I doubt about it...

Title: Re: ESP32-DevkitS module support
Post by Simon@Visual Micro on Nov 15th, 2021 at 1:42pm
Thanks for the detail and update on the upload method and chip in use.

There is a new OpenOCD Release for the ESP32 platform which we can integrate in a future release.
https://github.com/espressif/openocd-esp32/releases/tag/v0.10.0-esp32-20211111

You can download and try this with the current version of Visual Micro, by adding a custom debugger_launch.json, adding current settings:
https://www.visualmicro.com/page/Debugging-Using-Custom-Hardware.aspx

Then altering the paths to point to the new OpenOCD Release on your machine.

Title: Re: ESP32-DevkitS module support
Post by Dak on Nov 15th, 2021 at 2:46pm
Dear Simon, thank you so much for your effort. I tried new openOCD yesterday already, but it didnt help. Now I tried again, but there is some problem when openOCD tries to connect to DevkitS module...

New openOCD Log with DevkitS module:

Code (]
c:\ProgramData\VMicro\tools\openocd-esp32\bin>openocd -d2 -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/ftdi/minimodule-lowcost.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; reset halt"
Open On-Chip Debugger  v0.10.0-esp32-20211111 (2021-11-10-21:40)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 2

none
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : clock speed 2000 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : Listening on port 3333 for gdb connections
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : esp32: Debug controller was reset.
Info : esp32: Core was reset.
Error: Couldn't halt target before SoC reset
[/code):



New openOCD Log with DevkitC-v4 module:
[code]
c:\ProgramData\VMicro\tools\openocd-esp32\bin>openocd -d2 -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/ftdi/minimodule-lowcost.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; reset halt"
Open On-Chip Debugger  v0.10.0-esp32-20211111 (2021-11-10-21:40)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 2

none
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : clock speed 2000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller was reset.
Info : esp32: Core was reset.
Info : esp32: Detected debug stubs @ 3ffc0820
Info : Listening on port 3333 for gdb connections
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Target halted, PC=0x400E8972, debug_reason=00000000
Warn : Not full dbg stub table 1 of 2
Info : esp32: Debug controller was reset.
Info : esp32: Core was reset.
Info : esp32: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32: Core was reset.
Info : esp32: Target halted, PC=0x40000400, debug_reason=00000000
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : esp32: Debug controller was reset.
Info : esp32: Core was reset.
Info : esp32: Debug controller was reset.
Info : esp32: Core was reset.
Info : esp32: Detected debug stubs @ 3ffc0820
shutdown command invoked
Info : esp32: Restore debug stubs address 3ffc0820


I tried 2 pcs of ESP-Prog, OLIMEX ARM-USB-TINY-H debugger, second computer, cables change, but still there is this problem. It is interesting because DevkitS and DevkitC looks same. If DevkitS module will work properly there is chance to use 16MB Wroom module for developement.

Title: Re: ESP32-DevkitS module support
Post by Simon@Visual Micro on Nov 15th, 2021 at 3:18pm
Thanks for the detail.

The command is using the latest Openocd.exe, however the paths are using the old scripts provided in vMicro currently.

Does the below command change/improve the output? (run from c:\ProgramData\VMicro\tools\openocd-esp32\bin)
[code]openocd -d2 -s "c:\ProgramData\VMicro\tools\openocd-esp32\bin/share/openocd/scripts/" -f "C:\ProgramData\vmicro\tools\openocd-espressif-esp32-10.0.1/share/openocd/scripts/interface/ftdi/minimodule-lowcost.cfg" -c "set ESP32_RTOS none" -f "c:\ProgramData\VMicro\tools\openocd-esp32\bin/share/openocd/scripts/board/esp32-wrover-kit-3.3v.cfg" -c "init; reset halt"[/code]

Title: Re: ESP32-DevkitS module support
Post by Dak on Nov 15th, 2021 at 6:05pm
Dear Simon, thank you very much for your advice. It realy helped and the openOCD could be started in background same way as DevkitC module.
Unfortunately there are some new problems with gdb connection.
I tried to combine scripts from openOCD and Visual Micro, set the ESP32 Wrover Module as target but I wasnt successful.
I am getting the error:

Code (]Warning:
Cannot insert breakpoint 2.
Cannot access memory at address 0x400d0cdb (ESP32 Wrover Module)
Cannot access memory at address 0x400d0bfe (ESP32 Dev Module)[/code):


Please if possible, check this openOCD log:
[code]Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : clock speed 2000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller was reset.
Info : esp32: Core was reset.
Info : esp32: Detected debug stubs @ 3ffc0820
Info : Listening on port 3333 for gdb connections
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Target halted, PC=0x400DFA3B, debug_reason=00000000
Warn : Not full dbg stub table 1 of 2
Info : esp32: Debug controller was reset.
Info : esp32: Core was reset.
Info : esp32: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32: Core was reset.
Info : esp32: Target halted, PC=0x40000400, debug_reason=00000000
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'gdb' connection on tcp/3333
Info : esp32: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 45 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 99 KB
Info : esp32: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.flash' size 16384 KB
Info : Using flash bank 'esp32.flash' size 16384 KB
Info : esp32: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 45 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 99 KB
Info : esp32: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Auto-detected flash bank 'irom' size 16384 KB
Info : Using flash bank 'irom' size 16384 KB
Info : esp32: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 45 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 99 KB
Info : esp32: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Auto-detected flash bank 'drom' size 16384 KB
Info : Using flash bank 'drom' size 16384 KB
Warn : negative reply, retrying
Warn : negative reply, retrying
Warn : acknowledgment received, but no packet pending
Warn : acknowledgment received, but no packet pending
Warn : address 0x400d0bfe not writable
Error: esp32: Failed to write breakpoint instruction (-4)!
Error: esp32: Failed to add SW breakpoint!
Error: can't add breakpoint: unknown reason
Info : dropped 'gdb' connection

Some attached logs could help too...
Sorry to take your time, but I hope DevkitS module with 16MB support can be very handy for developers.
Have a nice evening. BR David
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=VisualMicroLogsDevkitS.txt ( 91 KB | 10 Downloads )

Title: Re: ESP32-DevkitS module support
Post by Simon@Visual Micro on Nov 15th, 2021 at 6:49pm
Thanks for the detail, I just wanted to confirm the latest version of openocd worked better via the command line.

We are only using one cfg file from the vMicro install: openocd-espressif-esp32-10.0.1/share/openocd/scripts/interface/ftdi/minimodule-lowcost.cfg

Is the posted output (not the attached log) from running OpenOCD and GDB via command line? Or from within Visual Studio?

Title: Re: ESP32-DevkitS module support
Post by Dak on Nov 15th, 2021 at 7:13pm
The output is from Visual Studio (c:\Users\dak\AppData\Local\Temp\VMBuilds\Test002\esp32_esp32\Debug\Test002.ino_DebugOpenOCD.log). Thank you very much for your new openOCD testing.

Title: Re: ESP32-DevkitS module support
Post by Simon@Visual Micro on Nov 15th, 2021 at 7:32pm
Thanks for confirming.

Have you added the Debugger_Launch.json to your project?  (vMicro > Add Code > Add Custom GDB Debugger (Advanced) )

If so the log from vMicro is showing the paths haven't been updated to your newest ESP32 OpenOCD folder (example attached, assuming the share/openocd/scripts/interface/ftdi/minimodule-lowcost.cfg has been copied over from the vMicro folder to the newest OpenOCD folder so all in one place)


https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=ESP32_DEV_Debug_debugger_launch_json_001.txt ( 2 KB | 7 Downloads )

Title: Re: ESP32-DevkitS module support
Post by Dak on Nov 16th, 2021 at 8:55am
Dear Simon, good morning and thank you so much for your support. It will be great to get 16MB ESP32 chips debug working. Yes I used custom json, tried to put the file everywhere, tried to change xml files, use second PC but finaly after few hours found the combobox with Manual/Custom option : ) Anyway it caused good step ahead, I hope the new error (same on both PC) could be fixed.

Code (]Unable to start debugging: Failed to find thread 1 for break event[/code):

Micro Build Log
[code]Launching custom debugger: file:///C:\Users\dak\Documents\Arduino\Test002\ESP32_DEV.Debug.debugger_launch.json
Hard resetting via RTS pin...

// MI Debugger Properties
{
  "serverLaunchTimeout": 5000,
  "filterStdout": false,
  "filterStderr": true,
  "targetArchitecture": "arm",
  "stopAtEntry": false,
  "externalConsole": false,
  "MIMode": "gdb",
  "MIDebuggerServerAddress": "localhost:3333",
  "cwd": "C:\\Users\\dak\\AppData\\Local\\Temp\\VMBuilds\\Test002\\esp32_esp32\\Debug",
  "MIDebuggerPath": "C:\\Users\\dak\\AppData\\Local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32-elf-gcc\\1.22.0-97-gc752ad5-5.2.0/bin\\xtensa-esp32-elf-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-esp32\\bin\\openocd.exe",
  "debugServerArgs": "-d2 -l \"{C:\\Users\\dak\\AppData\\Local\\Temp\\VMBuilds\\Test002\\esp32_esp32\\Debug/Test002.ino_DebugOpenOCD.log}\" -s \"c:\\ProgramData\\VMicro\\tools\\openocd-esp32/share/openocd/scripts/\" -f \"c:\\ProgramData\\VMicro\\tools\\openocd-esp32/share/openocd/scripts/interface/ftdi/minimodule-lowcost.cfg\" -c \"set ESP32_RTOS none\" -f \"c:\\ProgramData\\VMicro\\tools\\openocd-esp32/share/openocd/scripts/board/esp32-wrover-kit-3.3v.cfg\" -c \"init; reset halt\"",
  "setupCommands": [],
  "program": "C:/Users/dak/AppData/Local/Temp/VMBuilds/Test002/esp32_esp32/Debug/Test002.ino.elf",
  "logging": {
    "moduleLoad": false,
    "trace": false,
    "engineLogging": false,
    "programOutput": false,
    "exceptions": false,
    "traceResponse": false
  },
  "visualizerFile": "C:\\Users\\dak\\AppData\\Local\\Temp\\VMBuilds\\Test002\\esp32_esp32\\Debug\\debugger_tmp.natvis",
  "showDisplayString": true
}

Debug Log

Code (]openocd: Open On-Chip Debugger  v0.10.0-esp32-20211111 (2021-11-10-21:40)
openocd: Licensed under GNU GPL v2
openocd: For bug reports, read
openocd:      http://openocd.org/doc/doxygen/bugs.html
openocd: debug_level: 2
openocd:
=thread-group-added,id="i1"
GNU gdb (crosstool-NG crosstool-ng-1.22.0-97-gc752ad5d) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-host_w64-mingw32 --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
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"
0x40000400 in ?? ()
[New Thread 1073463852]
[New Thread 1073447000]
[New Thread 1073467960]
[New Thread 1073456088]
[New Thread 1073445228]
[New Thread 1073454676]
=thread-selected,id="1"
[New Thread 1073465264]
Program '' skončil s kódem 42 (0x2a).

OpenOCD Log
[code]Warn : Interface already configured, ignoring
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Detected debug stubs @ 3ffc0820
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : Listening on port 3333 for gdb connections
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Target halted, PC=0x400E8972, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu1: Target halted, PC=0x400E8972, debug_reason=00000000
Warn : Not full dbg stub table 1 of 2
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 45 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 99 KB
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 16384 KB
Info : Using flash bank 'esp32.cpu0.flash' size 16384 KB
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 45 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 99 KB
Info : Using flash bank 'esp32.cpu0.irom' size 100 KB
Info : esp32.cpu0: Target halted, PC=0x40092AEE, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 45 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 99 KB
Info : Using flash bank 'esp32.cpu0.drom' size 48 KB
Info : New GDB Connection: 1, Target esp32.cpu0, state: halted[/code]
SW Configuration:
Windows 10 Pro 20H2, build 19042.1348
VS Community 2022 17.0.0, .NET Framework 4.8.04084
Visual Micro 2021.1108.0, Arduino 1.8.16
Zadig 2.7 -> Dual RS232-HS libwdi 6.1.7600.16385
OpenOCD v0.10.0-esp32-20211111
Thank you again for your help & have a nice Tuesday.

Title: Re: ESP32-DevkitS module support
Post by Simon@Visual Micro on Nov 23rd, 2021 at 4:24pm
Thanks for the detail.

If you change the board.cfg file in use in the debugger_launch.JSON file from esp32-wrover-kit-3.3v.cfg to esp-wroom-32.cfg does this improve the situation?
(I have this working on a WeMos Lolin D32 with an ESP32-WROOM-32E 4MB chip in vMicro currently)

Do you have a WROOM-32D you can put into the DevKit-S board? (just in case there is something different about the connections, though all looks straight through from the docs)

Title: Re: ESP32-DevkitS module support
Post by Simon@Visual Micro on Feb 1st, 2022 at 3:23pm
Just to update, it is worth trying the latest release (21.11.08-19) available at the top of the board below:
https://www.visualmicro.com/forums/YaBB.pl?board=vs_arduino_ext_releases

To try the latest debugging setup, you will also need to add a local board.txt to the project, with the below entries:
[code]debug.toolingsystem=gdbscript
tools.openocd.debug.path={runtime.tools.openocd-esp32-0.10.1-2021.11.11.path}[/code]

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