Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Unable to establish a connection to GDB (Read 5513 times)
yet-another-average-joe
Junior Member
**
Offline


Posts: 27
Joined: Jul 27th, 2019
Unable to establish a connection to GDB
Aug 15th, 2020 at 6:00pm
Print Post  
Hello,

I've been a VM user (free version) for a couple years with Arduinos and my 3D printer, and never used the bebugging features. I registered a couple days ago.

I'm also a MSVC/MSVS user since VC++ 1.0 beta, 1993 if I remember correctly : came soon after the Win32 SDK and WinNT 3.1 beta...).

I'm new to STM32's (1 year : I started just before Roger Clarke's forum shut down : doesn't help).

I'm now attempting to use hardware debugging with a Blue Pill (genuine ST µC), and a chinese ST Link v2.0 (fake STM103C8 inside).

In VS+VM with this STLink, I can flash and serial debug, but in hardware debug mode, when I connect to process (Ctrl+Alt+P), I get "Unable to start debugging. Unable to establish a connection to GDB. Debug output may contain more information."

Output says "openocd.exe exited with code 1 (0x1). I searched all over the forum and the web, with no success. But english is not my first language...

(before I update VS to 16.7.1, the ProgramData\tools directory was empty...)

I suspect GDB is not installed. It seems to me I read somewhere on VM website that GNU Debugger is installed with Android VS extensions (????)

What am I missing ?
« Last Edit: Aug 15th, 2020 at 6:01pm by yet-another-average-joe »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Unable to establish a connection to GDB
Reply #1 - Aug 15th, 2020 at 6:20pm
Print Post  
I suspect that this is just a problem with the device id of the chinese stlink.

We will try to post some instructions of how to tweak openocd or ask for more info over the next few days.
  
Back to top
WWW  
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Unable to establish a connection to GDB
Reply #2 - Aug 15th, 2020 at 6:47pm
Print Post  
Something to try in the meantme.

The default stlink device id is 0x1ba01477. We need to find the device id if your clone in the logs but often it is 0x2ba01477. So you can do the following to override the default command line...

Add a board.txt to the project and add this to it. Then click save and try to start debug
Code
Select All
tools.stlinkv2.server.targetCmd=-c "set CPUTAPID 0x2ba01477" -f "{tools.openocd.debug.build.openocdscript}" 

  
Back to top
WWW  
IP Logged
 
yet-another-average-joe
Junior Member
**
Offline


Posts: 27
Joined: Jul 27th, 2019
Re: Unable to establish a connection to GDB
Reply #3 - Aug 16th, 2020 at 1:48am
Print Post  
Thanks for the answers.

I forgot to activate notifications, and meanwhile I've been tinkering with Visual Micro.
It seems the problem is solved, but I'm not sure why.

First I installed the Android development tools, according to this page : https://www.visualmicro.com/category/GDB.aspx ; I found this page using Google. "Any visual micro project, with the android tools installed, can now run gdb debug". I didn't find this information anywhere else in the documentation.

(I don't know if it's needed, or GDB was already was installed by Visual Micro...)

And I also switched to the official core. I was using the Roger's core (I prefer this one because some libraries I use don't compile and/or link with the ST Microelectronics core)

And it worked, with the usual debugging windows (variables and stack).

Is this correct ?

My STLink device id is 0x2ba01477 according to the log file.
Adding board.txt with this ID generates an error : GDB exit code 0x1
I deleted the newly created file, and the error dialog box didn't pop up again.

The hardware debugger seems to work fine with the official core only.

Do you confirm that Roger's Core is not supported ?

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Unable to establish a connection to GDB
Reply #4 - Aug 16th, 2020 at 2:11pm
Print Post  
I am pleased it was not a device id issue. 

VS2017 and 2019 come with the GDB tools as standard so there was nothing extra to install.

I forgot about Rogers core, yes it is supported but you have to alter a setting. I will try to post a link over the next week with how to do that.

  
Back to top
WWW  
IP Logged
 
yet-another-average-joe
Junior Member
**
Offline


Posts: 27
Joined: Jul 27th, 2019
Re: Unable to establish a connection to GDB
Reply #5 - Aug 17th, 2020 at 1:45am
Print Post  
Great !

(please note that I'm not in a hurry)
  
Back to top
 
IP Logged
 
Wilworks
Newbies
*
Offline


Posts: 7
Location: The Netherlands
Joined: Apr 12th, 2021
Re: Unable to establish a connection to GDB
Reply #6 - Dec 3rd, 2021 at 3:58pm
Print Post  
Hello VM support,
I’m using an ESP32 board with an ESP32 PROG board. I’m able to upload the program via JTAG so the board and connections are ok, I think. However, when uploading is ready a message pops up which says “Unable to start debugging. Unable to establish a connection to GDB. Debug information may contain more information.”
The output of Debug Window:
Starting: "C:\ProgramData\vmicro\tools\openocd-espressif-esp32-10.0.1\bin/openocd.exe" -d2 -l ug/testgdb.ino_DebugOpenOCD.log}" -s s/" -f s/interface/ftdi/minimodule-lowcost.cfg" -c "set ESP32_RTOS none" -f s/board/esp-wroom-32.cfg" -c "init; reset halt"
Starting: gcc8_4_0-esp-2021r2/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"
gcc8_4_0-esp-2021r2/bin\xtensa-esp32-elf-gdb.exe" exited with code -1073741515 (0xC0000135).

I scanned the forum but could not find any clue to solve the problem on my own so please help me. Earlier this year I had it al running but after that I did a number of updates, VS, VM,  Arduino IDE and several libraries ending up in a situation I can no longer use the hardware debugger. 
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: Unable to establish a connection to GDB
Reply #7 - Dec 3rd, 2021 at 4:17pm
Print Post  
Thanks for the report.

If you could attach the full build output as a text file, with the Verbose and Show Build properties set as shown at the top of the page it will help us to understand the issue further.

Also please attach the OpenOCD log from /testgdb.ino_DebugOpenOCD.log
  
Back to top
 
IP Logged
 
Wilworks
Newbies
*
Offline


Posts: 7
Location: The Netherlands
Joined: Apr 12th, 2021
Re: Unable to establish a connection to GDB
Reply #8 - Dec 4th, 2021 at 1:23pm
Print Post  
Hi Simon,
Thanks for the fast response and thanks in advance for your help. Attached the two files you asked for.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Wilworks
Newbies
*
Offline


Posts: 7
Location: The Netherlands
Joined: Apr 12th, 2021
Re: Unable to establish a connection to GDB
Reply #9 - Dec 4th, 2021 at 1:27pm
Print Post  
transfering testgdb.ino_DebugOpenOCD again
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Wilworks
Newbies
*
Offline


Posts: 7
Location: The Netherlands
Joined: Apr 12th, 2021
Re: Unable to establish a connection to GDB
Reply #10 - Dec 4th, 2021 at 1:47pm
Print Post  
Got this out in the Debug window after using the debugging command: Attach to Process
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Wilworks
Newbies
*
Offline


Posts: 7
Location: The Netherlands
Joined: Apr 12th, 2021
Re: Unable to establish a connection to GDB
Reply #11 - Dec 7th, 2021 at 12:16pm
Print Post  
Hi Simon,

I desperately waiting for a solution to the GDB connection problem. Did you already look into it?  Are the actions in the meantime a can try out?

Regards, Wil
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: Unable to establish a connection to GDB
Reply #12 - Dec 7th, 2021 at 12:19pm
Print Post  
Thanks for the detail.

It appears there were some DLL files missed from the ESP32 core, which their GDB.exe relies upon (libstdc++-6.dll and libgcc_s_sjls-1.dll).

This is resolved in the latest 2.0.1-RC1 ESP32 core which should be available in board manager using the development json URL: 
Code
Select All
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json 

« Last Edit: Dec 7th, 2021 at 12:19pm by Simon@Visual Micro »  
Back to top
 
IP Logged
 
Wilworks
Newbies
*
Offline


Posts: 7
Location: The Netherlands
Joined: Apr 12th, 2021
Re: Unable to establish a connection to GDB
Reply #13 - Dec 7th, 2021 at 2:23pm
Print Post  
Hi simon,
Thanks for the golden tip, the debugger starts now. 
I run the blink sketch to get familiar with the debugger and placed a breakpoint.  However, in the debugger all my step commands are greyed-out so no way to proceed. What I am doing wrong?
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: Unable to establish a connection to GDB
Reply #14 - Dec 7th, 2021 at 2:33pm
Print Post  
Have you landed on the breakpoint when this happens? (the yellow arrow should appear in the breakpoint when you hit it)

Until the code stops, you cannot step/continue.
  
Back to top
 
IP Logged
 
Wilworks
Newbies
*
Offline


Posts: 7
Location: The Netherlands
Joined: Apr 12th, 2021
Re: Unable to establish a connection to GDB
Reply #15 - Dec 7th, 2021 at 3:15pm
Print Post  
It suddenly works now. life is full surprises. Definitely my inexperience but the flywheel in turning now. Thanks again!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Unable to establish a connection to GDB
Reply #16 - Feb 19th, 2022 at 9:17pm
Print Post  
Off-Topic replies have been moved to this Topic.
  
Back to top
WWW  
IP Logged
 
Don Winchell
Junior Member
**
Offline


Posts: 19
Location: Nova Scotia Canada
Joined: Nov 23rd, 2021
Re: Unable to establish a connection to GDB
Reply #17 - Feb 20th, 2022 at 12:30pm
Print Post  
Well no response from the last post and after a few more hours I don't know if I know any more, but it seems for anyone who understands this, that the problem is contained in this error report.  So another attempt to see if someone may be able to shed some light, any light on this issues.  I have tried many "solutions" and have checke and rechecked my wiring. 
I have tried with just jtag hook up and no 3.3 to the esp32,  and two usb connectors (yes windows and vm do see the com port with the new driver), with jtag and serial.  I have tried every wiring configuation I can find, of course with conflicting info.  Some people say hook up the 3.3 AND plug in the second usb cable but I have NOT tried that case as espresif seems to say not to feed power to the board from two sources. Please see errors below
****[vMicro]**** Uploading App :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
Error during upload using programmer
The uploader process failed
Thanks for any suggestions 
  
Back to top
 
IP Logged
 
Don Winchell
Junior Member
**
Offline


Posts: 19
Location: Nova Scotia Canada
Joined: Nov 23rd, 2021
Re: Unable to establish a connection to GDB
Reply #18 - Feb 21st, 2022 at 12:34pm
Print Post  
Through some various other tests I have decided that there is a good chance the hardware/esp-prog board is defective.  If the boad is connected to the esp32 I can not upload to the board with direct usb cable to the esp32. If I disconnect the ground and one of the connecting wires, the esp32 will load.  If I leave the wires connected but unplug the esp-prog, the esp32 will load.  I think I have a bad esp-prog.  I have ordered another, it will take a while as I live in a third-world country (Canada) and it take awhile for things to get here from places far away (like the United States).  I will update after verifying the hardware situation.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: Unable to establish a connection to GDB
Reply #19 - Feb 21st, 2022 at 12:52pm
Print Post  
Thanks for the update, and hopefully the new board will resolve the issues.

A few notes:-
  • Supplying the power via just the USB connector to the target is the simplest way to ensure it has enough power, and of course ensure the GND line is always connected between the PROG and the target.
  • Ensure you set both power jumpers on the ESP-PROG to be 3.3v.
  • Also ensure you aren't using any of the JTAG IO pins (12-15) in your sketch (or the one already on the board)


  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint