VS Arduino
>> >> GDB debugging in Visual Studio 2017
https://www.visualmicro.com/forums/YaBB.pl?num=1489964108

Message started by rml on Mar 19th, 2017 at 10:55pm

Title: GDB debugging in Visual Studio 2017
Post by rml on 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!


Title: Re: GDB debugging in Visual Studio 2017
Post by Visual Micro on Mar 20th, 2017 at 12:18pm
Haven't tried gdb in vs2017 yet. will do shortly.

Title: Re: GDB debugging in Visual Studio 2017
Post by rml on Mar 29th, 2017 at 9:28am
Hello,

Please do let us know if we can help in any way with your investigations.
Thanks

Title: Re: GDB debugging in Visual Studio 2017
Post by Visual Micro on Apr 17th, 2017 at 9: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


Title: Re: GDB debugging in Visual Studio 2017
Post by rml on Apr 18th, 2017 at 6: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

Title: Re: GDB debugging in Visual Studio 2017
Post by Visual Micro on Apr 18th, 2017 at 7: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



Title: Re: GDB debugging in Visual Studio 2017
Post by rml on Apr 18th, 2017 at 7: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!

Title: Re: GDB debugging in Visual Studio 2017
Post by Visual Micro on Apr 18th, 2017 at 7:54pm
That's really useful thanks

Title: Re: GDB debugging in Visual Studio 2017
Post by rml on Apr 19th, 2017 at 6: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!

Title: Re: GDB debugging in Visual Studio 2017
Post by Visual Micro on Apr 20th, 2017 at 10:45am
Thanks, do you have the config settings for each of these (where not using defaults) ?

Title: Re: GDB debugging in Visual Studio 2017
Post by rml on Apr 20th, 2017 at 11:28am
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;


Title: Re: GDB debugging in Visual Studio 2017
Post by Visual Micro on May 1st, 2017 at 2: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

Title: Re: GDB debugging in Visual Studio 2017
Post by rml on May 21st, 2017 at 7: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

Title: Re: GDB debugging in Visual Studio 2017
Post by Visual Micro on Jun 3rd, 2017 at 12: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.

Title: Re: GDB debugging in Visual Studio 2017
Post by Visual Micro on Jul 28th, 2017 at 12:59pm
Off-Topic replies have been moved to this Topic.

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.