ST-Link debug not working

Discuss how to use the features of Atollic TrueSTUDIO, including the editor, assembler, C/C++ compiler, linker, debugger, static code analysis and team collaboration tools.

Moderators: Markus Girdland, Mattias Norlander

sztefano
Posts: 0
Joined: Mon Nov 16, 2015 4:40 am

ST-Link debug not working

Postby sztefano » Mon Nov 16, 2015 5:47 am

Hi,

I'm using recent Atollic Lite version (5.4). I've got some problems with stm32 discovery/nucleo boards (i've checked on stm32f0 and stm32f411) and ST-Link debug probe:

Atollic TrueSTUDIO gdbserver for ST-Link. Version 2.2.0 Pro
Copyright 2010-2015, Atollic AB.


Starting server with the following options:
Persistant Mode : Disabled
LogFile Name : debug_log.txt
Logging Level : 1
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled

Connecting to the ST-Link Debugger... OK
Waiting for debugger connection...


And nothing more happens. I haven't got any virtual drives in my computer.I've tried also disabling firewall etc. I'm running win7 64bit, ST-Link with upgraded firmware.
Any hints what could be wrong ?


Mattias Norlander
Posts: 273
Joined: Fri Apr 29, 2016 10:01 am

Hi sztefano, Hmm, my first guess

Postby Mattias Norlander » Mon Nov 16, 2015 7:18 am

Hi sztefano,

Hmm, my first guess is that the ST-Link driver is not installed correctly... Try connecting any of the two boards, then: "Control Panel --> System --> Device Manager --> Universal Serial Bus Devices --> STMicroelectronics STLink dongle"
Does the ST-Link show up as a USB device? And does it seem to be working (no yellow exclamation mark)? If the answer is NO to any of these questions then you need to re-install the ST-Link driver. Go here:
In your case you should probably run installer: %INSTALLDIR%\Atollic\TrueSTUDIO for ARM 5.4.0\Servers\ST-LINK_gdbserver\STLinkV2USBDriver\dpinst_amd64.exe

Next thing to check is that your anti-virus/firewall solution is not blocking the gdb client and server application to start and to connect using TCP/IP. The applications that must be allowed to communicate are:
arm-atollic-eabi-gdb.exe (Atollic\TrueSTUDIO for ARM 5.4.0\ARMTools\bin)
ST-LINK_gdbserver.exe (Atollic\TrueSTUDIO for ARM 5.4.0\Servers\ST-LINK_gdbserver)
By default the GDB-client will connect on TCP port: 61234

If the answer two both questions above were YES, and you still cannot make this work, then let's try to isolate next possible problem cause in the debug chain, which is the ST-Link GDB-server. Is the ST-Link GDB-server able to connect to your board launch and connect to the target board? Do this:
Run a CMD (dos-prompt), "cd" to %INSTALLDIR%\Atollic\TrueSTUDIO for ARM 5.4.0\Servers\ST-LINK_gdbserver\
Make sure the board is connected then run "ST-LINK_gdbserver.bat". If you do not have firewall rules preventing the connection to happen you should get this:

D:\Programs\Atollic\TrueSTUDIO for ARM 5.4.0\Servers\ST-LINK_gdbserver>ST-LINK_gdbserver.bat

Atollic TrueSTUDIO gdbserver for ST-Link. Version 2.2.0 Pro
Copyright 2010-2015, Atollic AB.

Starting server with the following options:
Persistant Mode : Enabled
LogFile Name : debug.log
Logging Level : 31
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled

Connecting to the ST-Link Debugger... OK
Waiting for debugger connection...
------
The above output means SUCCESS! Server is waiting for TrueSTUDIO (or rather the Atollic GDB-client to connect)
====================
BUT the ST-Link firmware could also be out-dated and this should be detected by the GDB-server when connecting to the device. If the ST-Link firmware needs an update you will get this error:

D:\Programs\Atollic\TrueSTUDIO for ARM 5.4.0\Servers\ST-LINK_gdbserver>ST-LINK_gdbserver.bat

Atollic TrueSTUDIO gdbserver for ST-Link. Version 2.2.0 Pro
Copyright 2010-2015, Atollic AB.

Starting server with the following options:
Persistant Mode : Enabled
LogFile Name : debug.log
Logging Level : 31
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled

Connecting to the ST-Link Debugger... FAIL

Error in initializing ST-Link device.
Reason: ST-Link firmware upgrade required. Please upgrade the ST-Link firmware using the upgrade tool.
GDB server exited
-----
If so, go start TrueSTUDIO --> Help --> Tools --> ST-Link Upgrade. You may need to reconnect the board before Upgrade utility can connect...
=====================

If you do get the output from the "SUCCESS" case above then the next troubleshooting case would be to have TrueSTUDIO NOT automatically start the GDB-server and instead connect to the "external GDB-server which you have launched from CMD as seen above. So to try to see if it is the TrueSTUDIO automatic start of the GDB-server that for some reason fails, let's disable "autostart local GDB server" and instead use "connect to remote GDB server". How is this done? In TrueSTUDIO --> Run --> Debug Configurations... --> Debugger --> Enable "Autostart local GDB-server"

Provided that TCP ports are right and that you have launched the ST-Link GDB-server from command-line as seen above TrueSTUDIO should now remote connect to your target.

Does this solve your problem? If so, which step?

Kind regards, Mattias

sztefano
Posts: 0
Joined: Mon Nov 16, 2015 4:40 am

Hello, Thank you for reply.

Postby sztefano » Mon Nov 16, 2015 9:05 am

Hello,

Thank you for reply.
None of your solution solved my problem.
My ST-Link is installed correctly with latest firmware.
I also disabled Windows firewall and anti-virus protection.
I checked with GDB server started from command prompt too - I've got message in console wundow
"Waiting for debugger connection… " but after run debug in Atollic nothing more happens.
(only error message after while: "Failed to connect to ST-LINK GDB server. Please make sure the ST-LINK GDB server is started properly prior launching the debug session." - but server is running as it should).

I think that there is no communication between gdb server and atollic client for some reason.

Mattias Norlander
Posts: 273
Joined: Fri Apr 29, 2016 10:01 am

If you open the task

Postby Mattias Norlander » Mon Nov 16, 2015 11:30 am

If you open the task manager and look for process names:
arm-atolliec-eabi-gdb.exe *32
ST-LINK_gdbserver.exe *32

Are these processes running when you are launching a debug session (remember the external GDB-server launch from CMD..)? Are there perhaps multiple instances of each of these processes running? If a debug session is not terminated properly, it is possible that residuals of these processes are are still running and jamming the TCP 61234 port. I think that could happen even if the processes are not showing in the task manager after quitting the debug session. If 61234 is jammed then try another port by specifying this in: %INSTALLDIR%\Atollic\TrueSTUDIO for ARM 5.4.0\Servers\ST-LINK_gdbserver\config.txt. OR your could just reboot the computer (yeah I know who... who likes that answer?!).

Any progress?

sztefano
Posts: 0
Joined: Mon Nov 16, 2015 4:40 am

Hello, Still nothing. I checked

Postby sztefano » Tue Nov 17, 2015 5:29 am

Hello,

Still nothing.
I checked also manual connection: I changed port to 2332 and started gdb server manually. Then I opened "arm-atollic-eabi-gdb" in another cmd line and typed command: target remote localhost:2332. In gdb server I got this:
Atollic TrueSTUDIO gdbserver for ST-Link. Version 2.2.0 Pro
Copyright 2010-2015, Atollic AB.


Starting server with the following options:
Persistant Mode : Enabled
LogFile Name : debug.log
Logging Level : 31
Listen Port Number : 2332
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled

Connecting to the ST-Link Debugger... OK
Waiting for debugger connection...Error while waiting for debugger connection, e
rror 37.
Shutting down...
Debugger connection lost.
Shutting down...


When running from Atollic (on port 2332) nothing happens again. (so I think that it is no problem with port 2332 or 61234).

andy_pevy
Posts: 0
Joined: Wed Feb 03, 2016 7:12 am

I am seeing the same

Postby andy_pevy » Wed Feb 03, 2016 8:18 am

I am seeing the same problem, BUT... It worked before I updated to Windows 10.

Now, it behaves exactly as described above.

Andy

Mattias Norlander
Posts: 273
Joined: Fri Apr 29, 2016 10:01 am

Connecting to the ST-Link Debugger…

Postby Mattias Norlander » Wed Feb 03, 2016 11:14 am


Connecting to the ST-Link Debugger… OK
Waiting for debugger connection…Error while waiting for debugger connection, error 37.
Shutting down…
Debugger connection lost.
Shutting down…


Hi,

The GDB-client is not supposed to be able to connect to the ST_Link GDB-server without the TS IDE launching the debug session. TrueSTUDIO IDE handles the client-server authentication. If authentication fails = error 37.

So trying that is futile, I should have mentioned that above. Sorry about that.

You should however be able to launch the debug server from command line:

So when using TS to connect to the ST_Link GDB-server and that should give this:



c:\Program Files (x86)\Atollic\TrueSTUDIO for ARM 5.4.0\Servers\ST-LINK_gdbserver>ST-LINK_gdbserver.bat

Atollic TrueSTUDIO gdbserver for ST-Link. Version 2.2.0 Pro
Copyright 2010-2015, Atollic AB.

Starting server with the following options:
Persistant Mode : Enabled
LogFile Name : debug.log
Logging Level : 31
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled

Connecting to the ST-Link Debugger... OK
Waiting for debugger connection...





This indicates GDB-server has connection with target and is ready waiting for TrueSTUDIO to alunch a debug session.

How far do you get?
Sztefano have you solved your issue yet?

sztefano
Posts: 0
Joined: Mon Nov 16, 2015 4:40 am

Sztefano have you solved your

Postby sztefano » Mon Feb 15, 2016 9:59 am



Sztefano have you solved your issue yet?


Hi,
I was not able to solve my issue in 100%, but I figured out, that when my ethernet plug is disconnected from ethernet switch debug works correctly. So probably this is some issue in my system configuration or something like that.

rpullman
Posts: 0
Joined: Sat Apr 09, 2016 6:23 am

I have similar problem when

Postby rpullman » Sat Apr 09, 2016 7:35 am

I have similar problem when I run the ST-Link debugger.
Error is
Error while launching command: .....TrueSTUDIO for ARM 5.4.2\ARMTools\bin\arm-atollic-eabi-gdb --version
Is it saying that the file needs updating? I have just loaded the tools in the past few days
The ST-Link driver is correctly installed and connects. But the error reported is the same whether the ST-Link is connected or not.

Mattias Norlander
Posts: 273
Joined: Fri Apr 29, 2016 10:01 am

If you get the same

Postby Mattias Norlander » Mon Apr 11, 2016 5:19 am

If you get the same error message regardless if the ST-Link is connected to your PC or not then something ought to be wrong twith the GDB-client.

Is the GDB-client installed properly? Launch it from command-line:
C:\Program Files (x86)\Atollic\TrueSTUDIO for ARM 5.4.2\ARMTools\bin\arm-atollic-eabi-gdb.exe
Is it allowed to start or is some anti-virus tool or firewall intercepting?

GDB-client cannot connect to ST-Link without TrueSTUDIO launching the GDB-client, so you cannot test GDB "client-server" connection.


Return to “Atollic TrueSTUDIO tool discussions”

Who is online

Users browsing this forum: No registered users and 3 guests