Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
ESP8266 Custom Config (Read 5598 times)
StevenV
Junior Member
**
Offline



Posts: 12
ESP8266 Custom Config
Feb 6th, 2018 at 1:58pm
 
Good morning,

I am working on a custom gdb config for ESP8266 modules.  I have configured the Platform.txt and added lines shown below:

debug.tool=gdb
tools.gdb.cmd=xtensa-lx106-elf-gdb.exe
tools.gdb.path=C:/SysGCC/esp8266/bin
tools.gdb.pattern="{path}/{cmd}" -interpreter=mi -d {build.project_path}

This enables the Microsoft Debugger mode.  I have verified that the GDB/OpenOCD work outside of Visual Studio.  I have setup an external OpenOCD process and can monitor it through a command prompt.

When I "Attach to Process" in VS 2017, it hangs at "Initializing Debugger.  I don't see any new connections to OpenOCD, and no errors in the logs.

Attached at the communication logs between VS 2017 and the Mircro debugger...

Any suggestions?
Thanks,
Steven


Back to top
 

gdb.zip (2 KB | )
 
IP Logged
 
StevenV
Junior Member
**
Offline



Posts: 12
Re: ESP8266 Custom Config
Reply #1 - Feb 6th, 2018 at 5:40pm
 
Adding board.buildinfo as well...
Back to top
 
 
IP Logged
 
StevenV
Junior Member
**
Offline



Posts: 12
Re: ESP8266 Custom Config
Reply #2 - Feb 7th, 2018 at 10:58pm
 
It looks like root cause of this issue might be that I get "<Unsupported debug option" in the proejct debug properties.  I verified that C++ Android tools are installed as well as "Arduino GDB for Visual Micro 2017". 

Available options are:
Local Windows Debugger
Remote Windows Debugger
Web Browser Debugger
Web Service Debugger

If I create a Linux C++ project, I get the option for local and remote GDB debugging.

What option should show for VM Arduino projects?  A VM specific debugger?  Any suggestions how I can get that to show?
Back to top
 
 
IP Logged
 
StevenV
Junior Member
**
Offline



Posts: 12
Re: ESP8266 Custom Config
Reply #3 - Feb 9th, 2018 at 1:41pm
 
I've tried uninstalling and reinstalling the extensions as well as VM.  Same results.

I also tried creating a new Arduino project with defaults and same results.

I checked the regedit setting for the microgdg.exe location, and I needed to copy the microgdb.exe to that location (C:\program files (x86)\VS\...Extensions\xaohtdp2.q2m\

I have run out of ideas and suggestions to try to fix this.


Edit:How can I tell if Microgdb is working correctly?  When i run it from a powershell, it executes, but I can't "target remote :3333"...  It doesn't produce any errors, but it also doesn't connect to a local openocd session.  To the best of my ability, I think I have the prerequisites installed, but something is just not right....


Anyone have any other ideas?
Thanks!!!
Back to top
« Last Edit: Feb 9th, 2018 at 5:19pm by StevenV »  
 
IP Logged
 
Visual Micro
Administrator
*****
Online



Posts: 10529
United Kingdom
Re: ESP8266 Custom Config
Reply #4 - Feb 13th, 2018 at 8:38pm
 
Sorry I missed this post earlier.

It is correct to see unsupported debugger in the options.

Questions-

After upload does "Debug>Attach To Process" attempt to start the debugger?

Have you enabled "vmicro>debugger>use visual studio debugging"?

Back to top
 
WWW  
IP Logged
 
StevenV
Junior Member
**
Offline



Posts: 12
Re: ESP8266 Custom Config
Reply #5 - Feb 14th, 2018 at 4:19am
 
Thank for the reply!

"vmicro>debugger>Microsoft GDB Debugger" is enabled.

After uploading, "Debug>Attach To Process" attempts to start the debugger, but after 15 seconds it times out.

Attached are the GDB logs, and platform.txt for the ESP8266 that I created.

I am using the ESP8266 gdb and openocd from the sysprogs toolchain (enhanced for esp8266) 

When debugging, I launched openocd previously/separately to try to see gdb attach to it, but nothing seems to connect to it.

Maybe the logs will poing in the direction.  Thanks again for your support!
Steven

Back to top
 

gdb_001.zip (2 KB | )
 
IP Logged
 
StevenV
Junior Member
**
Offline



Posts: 12
Re: ESP8266 Custom Config
Reply #6 - Feb 14th, 2018 at 4:26am
 
Side notes...

--I made sure that microgdb.exe and gdb started and ended between debugging attempts.

--Debugging using the GDB and openocd specified in the platform.txt work fine outside of Visual Studio using the same parameters.

--VS 2017 is fully patched and up to date.

--I've also tried recreating the Arduino projects from scratch with same results.

Steven
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Online



Posts: 10529
United Kingdom
Re: ESP8266 Custom Config
Reply #7 - Feb 14th, 2018 at 2:42pm
 
Useful info. I need to try it.

It is possible the sysprogs toolchain wants less instruction which would be an easy fix.

Can you tell me from where and what I need to install to replicate your tests?
Back to top
 
WWW  
IP Logged
 
StevenV
Junior Member
**
Offline



Posts: 12
Re: ESP8266 Custom Config
Reply #8 - Feb 14th, 2018 at 3:00pm
 
I downloaded the toolchain from:  http://gnutoolchains.com/esp8266/

First link: NonOS SDK 2.1.0; RTOS SDK 1.5.0; OTA; NodeMCU      7.11      esp8266-gcc5.2.0-r14.exe

The GDB Debugger I'm using is in C:\SysGCC\esp8266\bin\xtensa-lx106-elf-gdb.exe

The OpenOCD tool is in: C:\SysGCC\esp8266\esp8266-bsp\OpenOCD\bin\openocd.exe

The actual command for OpenOCD is:
c:\sysgcc\esp8266\esp8266-bsp\openocd\bin\openocd.exe -f C:\SysGCC\esp8266\esp8266-bsp\OpenOCD\bin\olimex-arm-usb-tiny-h.cfg -f C:\SysGCC\esp8266\esp8266-bsp\OpenOCD\bin\esp8266.cfg

I copied the 2 config files from directories under the OpenOCD folder into the bin folder just to make things easier.

Hope this is helpful!
Steven




Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Online



Posts: 10529
United Kingdom
Re: ESP8266 Custom Config
Reply #9 - Feb 19th, 2018 at 1:13pm
 
questions

where is your platform.txt located?

why is the openocd pre init tool commented out?

please save your platform.txt in a simpler format. note the unicode when viewed here
http://www.visualmicro.com/public_html/yabbfiles/Attachments/platform_008.txt
Back to top
 
WWW  
IP Logged
 
StevenV
Junior Member
**
Offline



Posts: 12
Re: ESP8266 Custom Config
Reply #10 - Feb 19th, 2018 at 5:16pm
 
Hi Tim,

The Path for Platform.txt is:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\xaohtdp2.q2m\Micro Platforms\arduino16x\hardware\esp8266

I commented out openocd in the config file and started it externally to better troubleshoot and see connections to the service.  When I uncomment it, it starts normally when debugging starts, but I can't see any command line for it.

Attached is a cleaner (I hope ) version of the platform.txt file, I'm sorry about the encoding.

Steven

Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Online



Posts: 10529
United Kingdom
Re: ESP8266 Custom Config
Reply #11 - Feb 19th, 2018 at 9:33pm
 
What external start command did you use
Back to top
 
WWW  
IP Logged
 
StevenV
Junior Member
**
Offline



Posts: 12
Re: ESP8266 Custom Config
Reply #12 - Feb 19th, 2018 at 11:33pm
 
I used this command to startup openOCD externaly:
c:\sysgcc\esp8266\esp8266-bsp\openocd\bin\openocd.exe -f C:\SysGCC\esp8266\esp8266-bsp\OpenOCD\bin\olimex-arm-usb-tiny-h.cfg -f C:\SysGCC\esp8266\esp8266-bsp\OpenOCD\bin\esp8266.cfg

I had previously copied the .cfg files from the share/openocd/scripts/interface/ftdi/olimex-arm-usb-tiny-h.cfg and share/openocd/scripts/target/esp8266.cfg  to the bin directory to make the command lines easier to work with and debug.
Back to top
 
 
IP Logged
 
StevenV
Junior Member
**
Offline



Posts: 12
Re: ESP8266 Custom Config
Reply #13 - Feb 27th, 2018 at 3:45am
 
Hi Tim,

Have you had any luck replicating the issue with the sysprogs toolchain?  Is there any additional information I can help provide?

As an aside, i substituted a Segger Jlink for the Olimex hardware with the same results. (still able to use OpenOCD and GDB outside of VS/VM to load and debug programs, but not from within.)

Thanks for your continued support!
Steven
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Online



Posts: 10529
United Kingdom
Re: ESP8266 Custom Config
Reply #14 - Feb 27th, 2018 at 8:20pm
 
Sorry I got delay. I have the tool chain installed but need to investigate the connection. I guess some soldering is required?
Back to top
 
WWW  
IP Logged
 
StevenV
Junior Member
**
Offline



Posts: 12
Re: ESP8266 Custom Config
Reply #15 - Feb 28th, 2018 at 2:15am
 
Yes, I suppose there is some hardware involved...

If you have either a NodeMCU, the connections are shown below.  Huzzah uses the same pin names, but the physical pin numbers are different. 

ESP8266 Signal      ESP8266 Pin      NodeMCU Signal      NodeMCU Pin      JTAG20 Signal      JTAG20 Pin
VDDPST              17                       VDD3V                      1 on J2              VDD                       1
VDD                      PAD                       GND                      2 on J2              GND                       4
MTDI              10                       GPIO12                      7 on J2              TDI                       5
MTMS              9                       GPIO14                      8 on J2              TMS                       7
MTCK              12                       GPIO13                      6 on J2              TCK                       9
MTDO              13                       GPIO15                      5 on J2              TDO                       13
EXT_RSTB              32                       RST                              3 on J1              nTRST or nSRST  3 (Olimex) or 15 (Segger)

These pinouts were borrowed from:  https://visualgdb.com/tutorials/esp8266/nodemcu/jtag/

The ESP8266 is a little quirky when jtag starts (It doesn't always respond to JTAG commands when a program is already running, but once GDB issues a "mon reset halt", the ESP8266 JTAG wakes up and listens to commands from that point forward.

I think once we can get microGDB talking to the ElfGDB, the reset of the details will sort themselves out as GDB is GDB (I hope).
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Online



Posts: 10529
United Kingdom
Re: ESP8266 Custom Config
Reply #16 - Mar 5th, 2018 at 2:10pm
 
Sorry for the delay.

It's so difficult for people to find guides for specific boards at the moment that I expect it will take too much time.

It seems what would be easier is to give more control to users to experiment with the scripts/options instead of hard coding in microgdb

I will try to extend microgdb over the coming week or so to provide these options then hopefully you can give it a try and find a stable set of commands for initial break/halt etc.
Back to top
 
WWW  
IP Logged
 
StevenV
Junior Member
**
Offline



Posts: 12
Re: ESP8266 Custom Config
Reply #17 - Mar 5th, 2018 at 4:41pm
 
Hi Tim,

I'll be happy to work with the scripts and options, and once a stable set is found, I will share back with the group so that others can benefit from the findings as well.

It isn't possible for you to try to manage every slight variation in boards, and empowering the users closest to the hardware to fix their own problems is a force multiplier.

I'll look forward to the new version with options.
Thanks,
Steven
Back to top
 
 
IP Logged
 
Simon Hopkinson
Administrator
*****
Offline



Posts: 49
Re: ESP8266 Custom Config
Reply #18 - Aug 21st, 2019 at 11:49am
 
vMicro now supports a range of additional hardware debuggers out of the box - including GDB Stub options for Uno/ESP8266 

ESP8266 GDB Stub Debugging: https://www.visualmicro.com/page/ESP8266-Debugging.aspx

ESP32 Hardware Debugging: https://www.visualmicro.com/page/ESP32-Debugging.aspx

Debugger List: https://www.visualmicro.com/page/DebuggerSupportList.aspx
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print