cancel
Showing results for 
Search instead for 
Did you mean: 

ST library and Ride7

stm322
Associate II
Posted on August 21, 2008 at 06:41

ST library and Ride7

5 REPLIES 5
stm322
Associate II
Posted on May 17, 2011 at 12:42

Hi everybody,

I experience the following ''problem''.

I use IDE Ride7 with GCC compiler to create project for the STM32. In Ride7, I ve got the option to use or not the ST library for STM32. I choose to use it, and request some function such as RCC_APB2PeriphClockCmd from the library.

Everything is compiling and linking fine.

But, if I add in my project source, the source code stm32f10x_rcc.c that is already defined in the library, the linker is still linking fine. It doesn't give me warning or error regarding the function RCC_APB2PeriphClockCmd defined in stm32f10x_rcc.c and in the library.

Does the linker has something clever looking for function first in my project source, and if not found check in library? Or is it something else?

I don't understand why I haven't got any errors.

If someone can just explain me why.

Thanks in advance.

andreas2
Associate II
Posted on May 17, 2011 at 12:42

I've never used Ride7 but I assume it has the library precompiled in an archive, like libstm32f10x.a, and then appends to the linker command the option -lstm32f10x. This telling the linker to search for undefined references in all the object files that make up the archive, and to pull in those object files that satisfy the references. So if you add stm32f10x_rcc.c to the project, the linker will already have those functions defined before checking the libraries and the library code will not be needed.

st3
Associate II
Posted on May 17, 2011 at 12:42

Quote:

Does the linker has something clever looking for function first in my project source, and if not found check in library?

That is usually the way that libraries work.

vincentchoplin9
Associate II
Posted on May 17, 2011 at 12:42

Hi,

I confirm that the code from the libraries is only added to the link if it includes at least one symbol (function or variable) that is required because it is referenced from some other code in the project and it is not already defined.

This is the standard way to handle libraries. I suggest you look at the GCC documentation if you want more information.

I also confirm that RIDE includes a precompiled version of the library. You will find it there:

[RIDE7InstallDir]\lib\ARM\STM32F10x_thumb.lib

You will also find the source code of the library and the project used for compiling it in this folder:

[RIDE7InstallDir]\lib\ARM\STM32F10x_LIB\...

Best Regards,

Vincent

(RAISONANCE)

[ This message was edited by: VincentC on 20-08-2008 15:04 ]

[ This message was edited by: VincentC on 20-08-2008 15:04 ]

[ This message was edited by: VincentC on 20-08-2008 16:21 ]

stm322
Associate II
Posted on May 17, 2011 at 12:42

understood,

thanks everybody for your help.