Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 10 months ago.
Include .o in mbed online IDE
Hey everyone
I have a .o file that has been compiled for the ARM Cortex M4 CPU and that I would like to include in my project. The file comes with a headerfile which defines some structs and the function that I can call.
So I put the two files into a folder in my project and included the header. But now I get the following compile errors:
Error: Cannot link object aC4.o as its attributes are incompatible with the image attributes. Error: ... wchart-16 clashes with wchart-32.
The two files are both called aC4.h and aC4.o and have been generated by a codegenerator(that's why I don't have any sourcecode).
Any idea why this happens?
Thanks in advance, Nicolas
1 Answer
8 years, 10 months ago.
.o files cannot be used but .ar files do.
Have a look at following posts for more info:
https://developer.mbed.org/questions/58311/Including-binary-library-files-in-a-buil/
https://developer.mbed.org/forum/mbed/topic/518/?page=1#comment-2609
https://developer.mbed.org/questions/55961/May-I-use-an-offline-compiled-library/
ok, here's what I understand reading this: .ar files are several .o files packed together.. the .o files therefore must fulfill certain criterias(AEABI compatible??) of which I do not understand any, but I guess I'll find out when trying to pack it. all the commands shown look like linux terminal commands.. I set up a virtual machine, but for any of the commands typed in, i receive a "command not found" message. Therefore I conclude that the needed programs are not installed. But in the store I do not find "armar" nor "armcc". Where could I find that?
Sorry, I'm still a student and have practically no experience with linux.. But thank already :)
Is there a windows packer I could install? Or even a online solution? How can I check wether the .o files I got fulfill the(AEABI compatibility)?
posted by 15 Feb 2016You can also download the free Keil MDK-Lite which contains the armar tool : http://www2.keil.com/mdk5/install/
A full user guide on Keil armar is available at : http://users.ece.utexas.edu/~valvano/Volume1/uvision/DUI0590A_using_the_armar_utility.pdf
posted by 15 Feb 2016Hey, thank you I succeeded in creating .a and .ar files. Then I realized that I can put any aribrary ending(.docx for example :P). I used the following command going into the directory "C:\Keil_v5\ARM\ARMCC\bin". I did this after having put myobject.o into the same directory.
armar - -create mylib.a myobject.o armar - -create mylib.ar myobject.o (- - because without gap it strikes the text out)
When I now copy the .a and .ar file into the project as well as the corresponding mylib.h file, i get the compiling error L6218E. https://developer.mbed.org/cookbook/Compiler-Error-L6218E (Undefined symbol myfunc(....) referred from myclass.cpp
As I understand it, this means that the function described in the header is not found in the .a or .ar file. Did I do something wrong? Or is this the point where I found out that it isn't AEABI compatible?
posted by 16 Feb 2016