Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
GDB debugging in Visual Studio 2017 (Read 2960 times)
Visual Micro
Administrator
*****
Offline



Posts: 8024
United Kingdom
Re: GDB debugging in Visual Studio 2017
Reply #14 - Jul 28th, 2017 at 1:59pm
 
Off-Topic replies have been moved to this Topic.
Back to top
 
WWW  
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 8024
United Kingdom
Re: GDB debugging in Visual Studio 2017
Reply #13 - Jun 3rd, 2017 at 1:53pm
 
I am so sorry I missed this email!! It's been a hektic few months.

Thanks very much indeed. That is really appreciated. I will link to the site.
Back to top
 
WWW  
IP Logged
 
rml
Full Member
***
Offline



Posts: 38
Re: GDB debugging in Visual Studio 2017
Reply #12 - May 21st, 2017 at 8:20am
 
By the way we just published a couple of tutorials on how to setup VS/VM for debugging. They were written for internal use originally, but other users might find them useful.

https://thingtype.com/blog/microcontroller-programming-in-visual-studio/
https://thingtype.com/blog/debugging-embedded-code-in-visual-studio/

We will add some details on how to setup debugging for nrf52 and stm32l4
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 8024
United Kingdom
Re: GDB debugging in Visual Studio 2017
Reply #11 - May 1st, 2017 at 3:21pm
 
Useful thanks. The 2017 gdb extension has now been published to a gallery page and contains a fix for a potential hang during break/interrupt
Back to top
 
WWW  
IP Logged
 
rml
Full Member
***
Offline



Posts: 38
Re: GDB debugging in Visual Studio 2017
Reply #10 - Apr 20th, 2017 at 12:28pm
 
Sure -
For ATSAMD21G18 via Atmel ICE we used the default for "Arduino Zero (Programing Port)

For STM32L4 via ST-Link V2 we used GrumpyOldPizza's BSP, and added this piece of code at the end of platform.txt (still a few things to cleanup as you can see, we also had to install a version of openOCD which supported the STM32L4):
################################ added for GDB debugging in Visual Micro
debug.tool=gdb

tools.gdb.pre_init.tool=openocd
tools.gdb.cmd=arm-none-eabi-gdb.exe
tools.gdb.path={runtime.tools.arm-none-eabi-gcc.path}/bin
tools.gdb.pattern="{path}/{cmd}" -interpreter=mi -d "{build.project_path}"

tools.gdb.openocd.cmd=bin/openocd.exe
# the following line is hard coded FOR NOW to hit the latest openOCD
tools.gdb.openocd.path=C:/Program Files/GNU ARM Eclipse/OpenOCD/0.10.0-201701241841
tools.gdb.openocd.params.verbose=-d2
tools.gdb.openocd.params.quiet=-d0

# the following 3 lines should NOT be hardcoded
tools.gdb.openocd.intf=stlink-v2
tools.gdb.openocd.stp=transport select hla_swd
tools.gdb.openocd.tttgt=stm32l4x
tools.gdb.openocd.pattern="{path}/{cmd}" -s "{path}/scripts/" -f "{path}/scripts/interface/{intf}.cfg" -c "{stp}" -f "{path}/scripts/target/{tttgt}.cfg"

For nRF52 via ST-Link V2 we used Sandeep Mistry's BSP, and added this piece of code at the end of platform.txt:
################################ added for GDB debugging in Visual Micro
debug.tool=gdb

tools.gdb.pre_init.tool=openocd
tools.gdb.cmd=arm-none-eabi-gdb.exe
tools.gdb.path={runtime.tools.arm-none-eabi-gcc.path}/bin
tools.gdb.pattern="{path}/{cmd}" -interpreter=mi -d "{build.project_path}"

tools.gdb.openocd.cmd=bin/openocd.exe
tools.gdb.openocd.path={runtime.tools.openocd-0.10.0-dev.nrf5.path}
tools.gdb.openocd.params.verbose=-d2
tools.gdb.openocd.params.quiet=-d0

tools.gdb.openocd.intf={upload.interface}
tools.gdb.openocd.stp={upload.setup_command}
tools.gdb.openocd.pattern="{path}/{cmd}" -s "{path}/scripts/" -f "{path}/scripts/interface/{intf}.cfg" -c "{stp}" -f "{path}/scripts/target/{upload.target}.cfg"

also for that one the boards.txt had to be changed since the default uploader for the nRF52DK is the onboard jlink by default:
nRF52DK.upload.interface=stlink-v2
nRF52DK.upload.setup_command=transport select hla_swd; set WORKAREASIZE 0x4000;

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



Posts: 8024
United Kingdom
Re: GDB debugging in Visual Studio 2017
Reply #9 - Apr 20th, 2017 at 11:45am
 
Thanks, do you have the config settings for each of these (where not using defaults) ?
Back to top
 
WWW  
IP Logged
 
rml
Full Member
***
Offline



Posts: 38
Re: GDB debugging in Visual Studio 2017
Reply #8 - Apr 19th, 2017 at 7:31pm
 
I confirm that GDB debugging works fine, tested on:
  • ATSAMD21G18 via Atmel ICE
  • STM32L4 via ST-Link V2
  • nRF52 via ST-Link V2

Thanks for the great feature!
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 8024
United Kingdom
Re: GDB debugging in Visual Studio 2017
Reply #7 - Apr 18th, 2017 at 8:54pm
 
That's really useful thanks
Back to top
 
WWW  
IP Logged
 
rml
Full Member
***
Offline



Posts: 38
Re: GDB debugging in Visual Studio 2017
Reply #6 - Apr 18th, 2017 at 8:45pm
 
Silly me, I was using the new GDB debugging extension, but not the VM version from that same page - it works great now!
We are going to test GDB debugging on a couple of other platforms that worked fine with VS/VM 2015 (nRF, STM32), and will report back.

Thanks again!
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 8024
United Kingdom
Re: GDB debugging in Visual Studio 2017
Reply #5 - Apr 18th, 2017 at 8:25pm
 
Hi,

Thanks for testing.

Did you also install the updated Visual Micro extension from the same page?

When the main arduino ide extension starts it ensures the following registry key contains a path to the visual micro gdb middle man called microgdb.exe. microgdb.exe is installed with the main extension.

The path is set into the registry which you can view with regedit.exe:-
HKEY_CURRENT_USER\Software\Visual Micro\Options\Debug General\MicroGdb Location

This is the path the mi debugger is saying is invalid so that's why I ask if you updated the visual micro extension from the same pre-release forum page linked previously.

If you have installed the latest visual micro arduino ide extension it will show a version number in tool>extensions and updates>installed of 1704.17


Back to top
« Last Edit: Apr 18th, 2017 at 8:37pm by Visual Micro »  
WWW  
IP Logged
 
rml
Full Member
***
Offline



Posts: 38
Re: GDB debugging in Visual Studio 2017
Reply #4 - Apr 18th, 2017 at 7:59pm
 
Thanks a lot for looking into this!

We tried on a couple of machines, but we get an error message: "Unable to start debugging. The value of miDebuggerPath is invalid".
Is there something we should configure?
Best,

Armel
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 8024
United Kingdom
Re: GDB debugging in Visual Studio 2017
Reply #3 - Apr 17th, 2017 at 10:05pm
 
The gdb in 2017 should be working now. It requires a small additional extension which is available in beta.

You need to install the latest update along with the new gdb extension, both are available for download via this pre-release thread

Back to top
« Last Edit: Apr 17th, 2017 at 10:07pm by Visual Micro »  
WWW  
IP Logged
 
rml
Full Member
***
Offline



Posts: 38
Re: GDB debugging in Visual Studio 2017
Reply #2 - Mar 29th, 2017 at 10:28am
 
Hello,

Please do let us know if we can help in any way with your investigations.
Thanks
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 8024
United Kingdom
Re: GDB debugging in Visual Studio 2017
Reply #1 - Mar 20th, 2017 at 12:18pm
 
Haven't tried gdb in vs2017 yet. will do shortly.
Back to top
 
WWW  
IP Logged
 
rml
Full Member
***
Offline



Posts: 38
GDB debugging in Visual Studio 2017
Mar 19th, 2017 at 10:55pm
 
Hello,

We can't seem to be able to get GBD debugging working on an Arduino Zero (Programming Port) in Visual Studio 2017.
Upload works fine, but when trying to debug, we immediately get an error pop-up from VS: "Unable to start debugging. Check your debugger settings by opening project properties and navigating to 'Configuration Properties-->Debugging".

It happens on all our PCs, even though they all debug fine with VS2015.

Any clue about what might be going on?

I have copied below the products installed according to VS2017's 'About' box.

Thanks!

Back to top
« Last Edit: May 1st, 2017 at 3:14pm by Visual Micro »  
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print