Sysprogs forums › Forums › VisualGDB › ESP8266_Thing: Failed to connect to the gdb stub
- This topic has 8 replies, 3 voices, and was last updated 6 years, 9 months ago by TvdVen.
-
AuthorPosts
-
October 7, 2017 at 23:24 #12611yc0284Participant
I tried to debug the ESP8266 thing with FTDI Breakout(https://www.sparkfun.com/products/9873) on visual studio 2017 with VisualGDB5.3. My operating system is win10.
After it complete program the flash and start to connect to Gdb stub, it shows the error below, is there any idea how can I fix this? Thanks!
C:\SysGCC\esp8266\bin\xtensa-lx106-elf-gdb.exe –interpreter mi C:\Users\namec\source\repos\EmbeddedProject18\VisualGDB\Debug\EmbeddedProject18
-gdb-version
=thread-group-added,id=”i1″
~”GNU gdb (GDB) 7.11\n”
~”Copyright (C) 2016 Free Software Foundation, Inc.\n”
~”License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \”show copying\”\nand \”show warranty\” for details.\n”
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-pc-mingw32 –target=xtensa-lx106-elf\”.\nType \”show configuration\” for configuration details.”
This GDB was configured as “–host=i686-pc-mingw32 –target=xtensa-lx106-elf”.
Type “show configuration” for configuration details.
~”\nFor bug reporting instructions, please see:\n”
~”<http://www.gnu.org/software/gdb/bugs/>.\n”
~”Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n”
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
~”For help, type \”help\”.\n”
~”Type \”apropos word\” to search for commands related to \”word\”…\n”
~”Reading symbols from C:\\Users\\namec\\source\\repos\\EmbeddedProject18\\VisualGDB\\Debug\\EmbeddedProject18…”
~”done.\n”
~”GNU gdb (GDB) 7.11\n”
~”Copyright (C) 2016 Free Software Foundation, Inc.\n”
~”License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \”show copying\”\nand \”show warranty\” for details.\n”
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-pc-mingw32 –target=xtensa-lx106-elf\”.\nType \”show configuration\” for configuration details.”
This GDB was configured as “–host=i686-pc-mingw32 –target=xtensa-lx106-elf”.
Type “show configuration” for configuration details.
~”\nFor bug reporting instructions, please see:\n”
~”<http://www.gnu.org/software/gdb/bugs/>.\n”
~”Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n”
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
~”For help, type \”help\”.\n”
~”Type \”apropos word\” to search for commands related to \”word\”.\n”
^done
-list-features
^done,features=[“frozen-varobjs”,”pending-breakpoints”,”thread-info”,”data-read-memory-bytes”,”breakpoint-notifications”,”ada-task-info”,”language-option”,”info-gdb-mi-command”,”undefined-command-error-code”,”exec-run-start-option”]
-gdb-set disassembly-flavor intel
^error,msg=”No symbol \”disassembly\” in current context.”
-gdb-set print demangle off
^done
-break-insert -f main
&”Function \”main\” not defined.\n”
^done,bkpt={number=”1″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”<PENDING>”,pending=”main”,times=”0″,original-location=”main”}
Warning: could not set a breakpoint on main. ‘Step into new instance’ will not work.
-break-delete 1
^done
Found an SPI FLASH section at 0x00020000. This image is a non-OTA image.
set serial baud 74880
&”set serial baud 74880\n”
=cmd-param-changed,param=”serial baud”,value=”74880″
^done
target remote \\.\COM7
&”target remote \\\\.\\COM7\n”
~”Remote debugging using \\\\.\\COM7\n”
~”Ignoring packet error, continuing…\n”
&”warning: unrecognized item \”timeout\” in \”qSupported\” response\n”
~”Ignoring packet error, continuing…\n”
~”Ignoring packet error, continuing…\n”
&”Bogus trace status reply from target: timeout\n”
^error,msg=”Bogus trace status reply from target: timeout”
-target-disconnect
^error,msg=”You can’t do that when your target is `exec'”
-gdb-exit
^exitException details:
System.Exception: Failed to connect to the gdb stub. Please check your settings.
at ESP8266DebugPackage.ESP8266StubDebugController.GDBStubInstance.DoConnect(IDebugStartService service, ISimpleGDBSession session, ESPxxGDBStubSettings settings, String comPort, Boolean programFLASH)
at ESP8266DebugPackage.ESP8266StubDebugController.GDBStubInstance.ConnectGDBToStub(IDebugStartService service, ISimpleGDBSession session)
at ul1.c1_2(DebugCustomizationSettings a)
at g52.t3()
at VisualGDB.GDBDebugEngine.x(a7 b, o1 a)
<h1 class=”hidden-sm hidden-xs”></h1>October 8, 2017 at 03:29 #12612supportKeymasterHi,
Please ensure the GDB stub is enabled on the first page of VisualGDB Project Properties and you call the initialization function from your entry function.
If this is the case, please try using the “test connection” button on the Debug Settings page and try experimenting with different UART speeds.
October 8, 2017 at 04:51 #12616yc0284ParticipantYes, the GDB stub is enabled, after I opened HttpDemo.c file and pressed F5 for debugging. it shows the error
For test connection, it shows two UART speed for GDB stub baud rate, 115200 and 74880. and I tried both of them for test, for 74880 the console return nothing, for 115200, it return “$`?” and both of them show’s the same error for debugging.
October 8, 2017 at 18:18 #12619supportKeymasterHi,
Thanks, looks like the UART baud rate might be set incorrectly. Normally the initial gdb stub message should look like this:
$T05#b9
Please try setting the UART speed explicitly by calling the following function before gdbstub_init():
UART_SetBaudrate(UART0, 74880);
If this does not help, please check the schematics of your board to see the crystal oscillator frequency. The default UART baud rate would be 115200 * (frequency / 40 MHz). E.g. for 26 MHz it would be 74880 .
December 29, 2017 at 15:43 #13353TvdVenParticipantI am encountering this same issue, and have tried the steps suggested above.
(Except for UART_SetBaudrate(UART0,74880), these are undefined in HTTPDemo.cpp, am I missing an include perhaps?).
I am using the Visual Studio 2015 extension for VisualGDB on Win8.1.
I have tried the following GDB Stub Baud Rates: 74880, 115200 and 74800 (as shown in the example here).
I have left Bootloader Baud Rate at 115200.
The bitrate of my usb-serial com connection defaults to 9600, I am unsure if this is related.
When I ‘Test’ the debugging using Bootloader + GDB Stub from the debug settings a window pops up, but nothing is ever logged.
It appears to hang on ‘Connecting to stub…’ in the bottom left.
When trying to debug the project, the chip is flashed but connecting to the GDB stub times out with what appears to be the same output as OP.
“VisualGDB has encountered a problem while starting debugging: Failed to connect to the gdb stub. Please check your settings.”
Has a solution been found for this problem? Any advice will be appreciated 🙂
December 29, 2017 at 20:27 #13358supportKeymasterHi,
This could be happening due to an invalid FLASH mode/frequency. Please try experimenting with different FLASH modes (DIO/QIO) and setting the frequency to the minimum value.
January 3, 2018 at 11:39 #13363TvdVenParticipantHello,
Thank you for the suggestion, based on this I have tried every permutation of the following settings:- GDB Stub Baud Rate 74800/74880/115200
- Bootloader Baud Rate 115200
- FLASH Mode QIO/DIO
- FLASH Frequency 40/26/20/80 MHz
No success, though.
To double check whether I even have the correct GND pin, I changed it, which results in a failure to connect to the bootloader before flashing even happens, so I believe the connection is correct.
I also, only now, thought to check whether flashing was actually successful (beyond the progress bar completing). Using the settings
[ GDB Stub Baud Rate 74880 / Bootloader Baud Rat 115200 / FLASH Mode QIO / FLASH Freq. 26 MHz / FLASH Size 2MB – c1 ] I am able to flash successfully (ESP8266 properly starts hosting a simple ‘Hello World’ web page, which I can connect to).
It’s nice to know that something is working, but unfortunately VisualGDB is still failing to connect to the GDB stub. Do you maybe have any other advice?
I’m going to try a different USB->UART cable next (I also have a second ESP8266 board, which I will try as well), in case there’s a hardware error (however unlikely).
Thanks for the help so far!
January 5, 2018 at 06:46 #13375supportKeymasterHi,
If the device shows the correct “Hello, World” page, but the gdb stub doesn’t work, the problem is likely related to UART settings. Please try replacing user_init() with this:
int user_init() { gdbstub_init(); for (;;) { os_printf("%c", 0x55); } }
Then program the firmware, open the COM port in a terminal and restart your board. Normally you should see something similar to this:
load 0x40100000, len 31360, room 4 tail 12 chksum 0x41 csum 0x41 s?stem param error, use last saved param! rf cal sector: 120 rf[112] : 03 rf[113] : 00 rf[114] : 01 SDK ver: 2.0.0(656edbf) compiled @ Jul 19 2016 17:58:40 phy ver: 1055, pp ver: 10.2 $T05#b9
The “$T05#b9” message is generated by the gdb stub (it’s actually a gdb packet reporting a stop). If you don’t see the message, please comment the call to gdbstub_init() and use a logic analyzer to check the output of the UART pins. 0x55 corresponds to 01010101 in binary form, so observing the output in a logic analyzer and measuring the signal period should help find the baud rate the board is using.
January 19, 2018 at 09:39 #13521TvdVenParticipantHi, thank you for the advice. I have since started using a Segger J-Link de debug rather than the GDB stub, and this has solved the problem (though it is not exactly clear to me how).
In case it might still help someone, I have attached a screencap of the settings that I am now using, though I had tried this permutation previously with the GDB stub without success.
Attachments:
You must be logged in to view attached files. -
AuthorPosts
- You must be logged in to reply to this topic.