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) GDB debugging in Visual Studio 2017 (Read 19455 times)
rml
Junior Member
**
Offline


Posts: 38
Joined: Aug 29th, 2016
GDB debugging in Visual Studio 2017
Mar 19th, 2017 at 10:55pm
Print Post  
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!

« Last Edit: May 1st, 2017 at 2:14pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


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


Posts: 38
Joined: Aug 29th, 2016
Re: GDB debugging in Visual Studio 2017
Reply #2 - Mar 29th, 2017 at 9:28am
Print Post  
Hello,

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: GDB debugging in Visual Studio 2017
Reply #3 - Apr 17th, 2017 at 9:05pm
Print Post  
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

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


Posts: 38
Joined: Aug 29th, 2016
Re: GDB debugging in Visual Studio 2017
Reply #4 - Apr 18th, 2017 at 6:59pm
Print Post  
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
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: GDB debugging in Visual Studio 2017
Reply #5 - Apr 18th, 2017 at 7:25pm
Print Post  
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


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


Posts: 38
Joined: Aug 29th, 2016
Re: GDB debugging in Visual Studio 2017
Reply #6 - Apr 18th, 2017 at 7:45pm
Print Post  
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
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: GDB debugging in Visual Studio 2017
Reply #7 - Apr 18th, 2017 at 7:54pm
Print Post  
That's really useful thanks
  
Back to top
WWW  
IP Logged
 
rml
Junior Member
**
Offline


Posts: 38
Joined: Aug 29th, 2016
Re: GDB debugging in Visual Studio 2017
Reply #8 - Apr 19th, 2017 at 6:31pm
Print Post  
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
 
Tim@Visual Micro
Administrator
*****
Offline


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


Posts: 38
Joined: Aug 29th, 2016
Re: GDB debugging in Visual Studio 2017
Reply #10 - Apr 20th, 2017 at 11:28am
Print Post  
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
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: GDB debugging in Visual Studio 2017
Reply #11 - May 1st, 2017 at 2:21pm
Print Post  
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
Junior Member
**
Offline


Posts: 38
Joined: Aug 29th, 2016
Re: GDB debugging in Visual Studio 2017
Reply #12 - May 21st, 2017 at 7:20am
Print Post  
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
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: GDB debugging in Visual Studio 2017
Reply #13 - Jun 3rd, 2017 at 12:53pm
Print Post  
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
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: GDB debugging in Visual Studio 2017
Reply #14 - Jul 28th, 2017 at 12:59pm
Print Post  
Off-Topic replies have been moved to this Topic.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint