Topic : How to include static libraries in Ride 7 projects

Forum : Ride IDE

Original Post
Post Information Post
February 27, 2012 - 2:54pm
Guest

Hello,

I am working on a RIDE 7 based project. And I need to include some static libraries (file extensuin .a) in my project.

How could this be done?

Thanks in advance.

Replies
Post Information Post
+1
0
-1
February 27, 2012 - 2:59pm
Raisonance Support Team

Hi,

Just add the .a file to the project as if it was a source file (.c) using "Add Item" command or drag-and-drop from Windows Explorer.

Best Regards,

Vincent

+1
0
-1
February 29, 2012 - 10:36am
Guest

Hello Vincent,
thank you for your reply.
I tried to include them as you described, but I think this has no effect.
Because the build log didn't change before and after including thestatic libraries (.a)...

+1
0
-1
February 29, 2012 - 1:40pm
Raisonance Support Team

Hi,

Assuming you are compiling for ARM... (?)

The build log is not supposed to change after this modification, because the list of input files for the linker is contained in a temporary linker script file. (re-generated at every link)
Look at the .ld file that is referenced on the command line displayed in the build log. (usually ".elf.ld")

Best Regards,

Vincent

+1
0
-1
March 1, 2012 - 3:58pm
Guest

Hi,

Yes, I am compiling for ARM core.
I looked in the file "xxx.elf.ld" and I didn't found any reference to the static library that I want to include in my project.

Moreover, I tried the following steps in order to test if the static library is correctly included in the RIDE project :
1- I added the static library (.a extension) to my RIDE project by drag-and-drop from Windows Explorer.
2- From Windows Explorer, I changed manually the name of the file .a.
3- I rebuild the project.
4- In the build log, there is no indication that the RIDE project didn't found the static library that I included in step 1.

==> Conclusion : If the static library was correctly included in RIDE project, changing the name of the static library file from Windows Explorer will cause a link error!!

+1
0
-1
March 1, 2012 - 4:30pm
Raisonance Support Team

Hi,

I just double-checked here using the current/latest versions of the software and it works fine.

Please confirm that you are using the latest versoins of the software:
Ride7 version 7.36.11.0280
RKit-ARM version 1.38.12.0027

Please also confirm that you added the lib to the application, not to the project.

Best Regards,

Vincent

+1
0
-1
March 1, 2012 - 4:55pm
Guest

Hi,

The versions of the software I am using are:
Ride7 version 7.30.10.0159
RKit-ARM version 1.26.10.0130

Is there any difference between adding the static library to the application and adding it to the project?
Would you explain the difference please?

Here, I created a subfolder under the Application node of the RIDE explorer.
Then, I drag-and-drop the static library file under this folder.

Best Regards,
Ali

+1
0
-1
March 2, 2012 - 9:16am
Guest

Hi,

I installed the latest versions of (Ride+RKit) from the raisonance website.
And this works fine :))
The static library is correctly included in my RIDE project .
The "xxx.elf.ld" contains an entry for the static lib .a.
Thanks for your help.
Have a nice day.

Best regards,
Ali.

+1
0
-1
May 4, 2012 - 11:07pm
Guest

Hi Vincent,could this solve my problem too?I want to link an external library (*.lib) to my project and I always got this linker error message:

+1
0
-1
May 12, 2012 - 11:42pm
Guest

strange... samething ate most of my post... so again.

I got the linker message

undefined reference to functionname

The library was written with the Keil-IDE and GCC, so I erroneously thought, I could use it directly... it didnt work. I got the *.lib-file and the according *.h-file.

Any ideas, what to do to link it correctliy?

Regards

+1
0
-1
May 14, 2012 - 5:25pm
Raisonance Support Team

Hi,

Did you place the library _after_ the files that call it? Keep in mind that with libraries, the order of the link matters. And it gets more complex if libraries call other libraries. This also applies to functions calling other functions in the same library. The order matters. Typically, check that your 'functionname' which is not found is not linked before the funtion that calls it.

Did you make sure that your two versions of GCC are close enough to be compatible, and also the options?

If this doesn't help, please send us (support@raisonance.com) some files that will allow us to reproduce the problem.

Best Regards,

Vincent

+1
0
-1
May 16, 2012 - 9:53am
Guest

Hello, Vincent,
how can I influence the linking order? I really don't know. I always thought ... let the linker do his work.... :/
And in the context of eventually two different compiler versions:
is it possible, only to update the compiler and according linker by replacing it with the "newer" ones or have I to reinstall the complete RArmKit?

Regards

+1
0
-1
May 16, 2012 - 10:06am
Raisonance Support Team

Hi,

The input files are provided to the linker in the order in which they appear in the project view of Ride.
So you should just need to put the library at the bottom.... Unless your library is supposed to be called _from_ one of the standard libraries, which are linked at the end. In this case it's more complex. It can be done but it's usualy easier to use the object files instead of the library. And then indeed you don't care about the order.

For the versions, you could replace only GCC, but then there might be conflicts with the startups and linker scripts, so it's better to update the whole RKit-ARM. And in any case the newer versions of RKit-ARM include (apart GCC) improvements that are not neglectible...

Best Regards,

Vincent

+1
0
-1
May 16, 2012 - 11:56pm
Guest

Hi Vincent
I've sent you an email with the attached project...
Looking forward to your reply. Thanks a lot

Kai

+1
0
-1
May 17, 2012 - 2:36pm
Guest

Hi Vincent,
the linking problem is solved, I think... it was a stupid PEBCAK-error... problem exists between chair and keyboard *ashamed*
Who's got eye's to read, should read... it was a silly stupid typing error.

Compiling and linking did work now, but und debugging and/or programming the µC I got another error message now.
The Debugger throws the message: OPI driver error (1004): execution out of debugging limitation PC = 0xFFFFFFFE
I think this depends on the settings in the linker script? Any idea, where to search for the reason?

Regards

Kai

+1
0
-1
May 18, 2012 - 10:46am
Raisonance Support Team

Hi Kai,

Yes, you should check your linker script, as it looks like your Cortex does not find the proper startup address (Which is at address 0x00000004, in little endian -LSB first so REVERSED-). Also this address should be aligned on 16-bits (its last bit must be set to indicate Thumb mode, but is not part of the address itself).

Best Regards,

+1
0
-1
May 18, 2012 - 1:02pm
Guest

Hi Bruno,
all is well now... the typing error is corrected and the linker error was solved by doing the project new... don' know, what was wrong with the older one, but now it works.
The only thing, one have to remember, is, like Vincent wrote, that the *.lib file has to be in the bottom area of the explorer's tree.

Thanks a lot

Regards

Kai