cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot import variables in STM Studio. Error opening ST-Link connection.

cdmech
Associate II

Hello All,

I am hoping to reach out to the community for help with an error that I am experiencing with STM Studio. I recently installed STM Studio, part #: STM-STUDIO-STM32, version: 3.6.0.

When I try to import a variable to view I get an error message (picture attached) stating:

GDB cmd [print /x &(AHBPrescTable[0])] failed:

Error: Address of symbol "AHBPrescTable" is unknown.

I get two subsequent errors when I try to send the variable to the viewer:

Error opening ST-Link connection

Failure opening connection with target

I have downloaded and installed Java Runtime Environment: jre-8u201-windows-x64

I am using:

OS: Windows 10 x64 bit

IDE: Atollic TrueStudio v9.1.0

Debugger/Programmer: ST-LINK V2

Chip: STM32F030R8T6 (ARM core M0)

I had a similar error connecting to the ST-Link when I first tried using Atollic TrueStudio. The issue at that time was that Windows Defender was blocking st-link_gdb server.

I have tried running STM Studio with Windows Defender turned off, but it did not fix the problem in this case. Any insight and solutions you can provide are most appreciated! Thank you.

13 REPLIES 13
Jeroen3
Senior

Some constructs of variables are not supported by STMStudio, just click ok and continue.

I get 10 or so of those errors when I'm importing the elf of my projects.

I believe this is due to some things being optimized by the compiler, where they do exist in the symbol table, without actually being linked. I never bothered to look into this further.

AvaTar
Lead

You could check the map file to see where it's supposed to end up.

With the SPL, the AHBPrescTable used to be "const volatile".

Hello Jeroen3,

Thank you for your kind reply. I must apologize for my delayed response. I have managed to push past the initial errors (about 3 of them) as you suggested. I got my variable populated under "Display Variables settings", but when I press the "play" button, I get a few more errors. These say: Error opening ST-Link connection and Failure opening connection with target (picture attached). I feel like this has something to do with the SWD, but I cannot say for sure. Have you encoutered these errors before? Thank you

Hello AvaTar,

Thank you for your kind reply. I must apologize for my delayed response. Please forgive my ignorance, but can I ask what a map file is? Where might I find the map file related to my program? Also, might I ask what SPL stands for? Thanks again.

SPL was ST's "Standard Peripheral Library", before Cube. You can still download them for older MCU variants (F1,F2,F0,L0, L1, many F3 and F4),

The map file is a text file created by the linker for human consumption.

It lists all linker objects (variables, functions, etc. ) that go in your code, with addresses and sizes.

Not sure if TrueStudio creates it by default, you might enable it in the project options. And I'm neither sure of the name TrueStudio gives it. It is, as said a readable text file, and can become quite large.

Check if it contains a reference to your variable(s) - if not, they are probably optimized out.

Hello again AvaTar,

Thank you for kindly taking the time to explain all of that to me. Thanks to your help I was able to locate the .map file and look at it. The variable address in the .map file and in STM Studio were the same. This gives me some confidence that STM Studio is able to read and understand my .elf from TrueStudio. The issue is not completely solved, but I am one step closer! Thank you.

cdmech
Associate II

Hello Community,

While I do not have a perfect solution, I did get STM Studio somewhat working. It seems one issue is that only one source is allowed to link with the microcontroller at a time. During previous tests, Atollic TrueStudio was still linking while I was trying to link with STM Studio. The initial error messages remain, but they can be bypassed.

GDB cmd [print /x &(AHBPrescTable[0])] failed:

Error: Address of symbol "AHBPrescTable" is unknown.

STM Studio is, AFAIK, free of charge.

This might be one of the limitiations you might need to live with. I remember other toolchains/debuggers, that could not show static variables.

Once you used a toolchain like Keil or IAR, and exploited it's capabilities, you know what you pay the money for. (Not an ad to throw your money at Keil/IAR ... 😉 )

Right you are, AvaTar! I am most appreciative to ST for providing free software and a community forum like this to help users connect and solve problems together. Thank you to you and Jeroen3 for taking time to help me.