VS Arduino
Visual Micro >> Hardware Debugging (GDB, GDB WiFi, GDB Stub) >> Unable to start debugging - STM32 VS2019
https://www.visualmicro.com/forums/YaBB.pl?num=1564462874

Message started by mark4321 on Jul 30th, 2019 at 5:01am

Title: Unable to start debugging - STM32 VS2019
Post by mark4321 on Jul 30th, 2019 at 5:01am
I have been trying to get debugging to work with a very simple setup but with no success so far. The hardware is an STM32 blue pill board (STM32F103C8) with a ST-Link v2 using the SWDIO and SWCLK lines along with 3v3 and GND. I have generated a simple blink application toggling the LED on PC13. This works fine when I download the compiled binary. The software environment is Visual Studio 2019 (latest update 16.2.0) and Visual Micro (latest update 1907.29.3) on Windows 10. (I have been trying to get this to work for a couple of weeks on and off so have tried previous versions with no luck. I just updated to the latest VM in the hope that the problem might be fixed but sadly no difference) I have set up the visual micro environment to generate a debug binary and am using hardware debugging. When I try to start the debugging session the code is downloaded to the hardware however I get a vs dialog  "Unable to Start debugging. Unable to establish a connection to GDB. Debug output may contain more information". So I had a look at the debug output and see the openocd command line which is apparently trying to execute but exits with error code 1 (0x01). Closer inspection of the command line shows a log file being generated /Blink1.ino_DebugOpenOCD.log where the log file name is preceded by the temp directory below the AppData directory. The log file contains what I assume is the issue in the following "embedded:startup.tcl:60: Error: Can't find C:\ProgramData\vmicro\tools\openocd-0.10.0.1/scripts/{build.openocdscript}
in procedure 'script'
at file "embedded:startup.tcl", line 60"
It is at this point I am stuck. I am not sure what {build.openocdscript} should expand to in the  "C:\ProgramData\VMicro\tools\openocd-0.10.0.1\scripts" directory. I am also assuming at this stage that Windows 10 is not to bothered by the \ versus / separators. Any clues that might point me to a resolution of this would be greatly appreciated. What should be a simple exercise according to the visual micro website GDB debugging description is turning out to be far from that.

Thanks in anticipation. Mark

Title: Re: Unable to start debugging - STM32 VS2019
Post by Simon Hopkinson on Jul 30th, 2019 at 8:18am
Would it be possible to attach the debug output from the build (explained in yellow box at top of page). 

This will help us identify what is happening for this configuration more easily.


Title: Re: Unable to start debugging - STM32 VS2019
Post by mark4321 on Jul 30th, 2019 at 10:01am
Thanks for the response Simon. Attached is the output from a clean build.
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=Clean_micro_build.txt ( 165 KB | 4 Downloads )

Title: Re: Unable to start debugging - STM32 VS2019
Post by Simon Hopkinson on Jul 30th, 2019 at 11:14am
Thanks for the detail, there is something missing in our configurations around this.

For now if you right click the project > Add > Add Local Board.txt

Then paste in the line below and save the file, and try attaching again, it should work as expected.

[code]build.openocdscript=target/stm32f1x.cfg[/code]

Title: Re: Unable to start debugging - STM32 VS2019
Post by mark4321 on Aug 1st, 2019 at 1:46am
I made the change you suggested however am still unable to start the debugger. I still get the vs dialog "unable to start debugging. unable to establish a connection to GDB." I checked the log file and now get the error message "Error: Debug adapter does not support any transports? Check config file order.
Error: unable to select a session transport. Can't continue.
shutdown command invoked"

I have tried this with two different configurations, both with the same result. The first configuration is using a stm32f103c8 blue pill with a chinese st link v2 connected via a 4 pin 3v3, SWDIO, SWCLK and GND connector. The second configuration is using a genuine ST-link v2 connected via a JTAG cable to a st32f103c8 board with a 20 pin JTAG connector. Both configurations program the device with no issues and both configurations give the same error when trying to run the debugger. Both of the st links are updated to the latest firmware. Thanks for your help so far.

Title: Re: Unable to start debugging - STM32 VS2019
Post by Visual Micro on Aug 4th, 2019 at 3:19pm
Please try the latest release currently 1908.4.0

https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES

Simon made some improvements but they are not i the gallery yet.

You should not need any local board.txt properties. This might help but if not then please follow the guide in yellow above. Then click debug>attach. After you see the debug error switch the output window to "Micro Build" and copy the output into a .txt so we can see it.

Thanks

Title: Re: Unable to start debugging - STM32 VS2019
Post by mark4321 on Aug 5th, 2019 at 7:19am
I installed the latest VM build. Unfortunately I still get the 'unable to start debugging' dialog after downloading the binary to the target and attempting to attach to the process. I have attached the micro build output. Thanks.
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=Micro_build_2.txt ( 43 KB | 2 Downloads )

Title: Re: Unable to start debugging - STM32 VS2019
Post by Visual Micro on Aug 5th, 2019 at 3:25pm
Sorry, we might finally have fixed the issue in 1805.5.1 see LATEST here

https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES

Thanks

Title: Re: Unable to start debugging - STM32 VS2019
Post by mark4321 on Aug 6th, 2019 at 2:39am
It now appears to be working correctly. I have tried it on both the simple blink example and a much larger project I have been working on. I can run the debugger on both. Thanks for your help.

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