i have a static library (.a library) crated with the gnu compiler, how can i use this library in a keil project? is it possible to compile it with ARM compiler?
>>is it possible to compile it with ARM compiler? Do you have the source? Does it contain any GNU specific coding?
No, unfortunately i don't have the source code, but i would like to know how can i compile it in both cases? : when the source code contains GNU specific coding and when the source code is specified also for both compilers GCC and ARM. Thanks
"Compiling" is the process of translating source files to object files.
So, if you don't have the source files, you cannot do any compiling at all - with any compiler.
So is your question really: "Can the Keil Linker accept a library built with GNU tools?"
Yes i mean Link a gcc .a library to a keil project which will be compiled with ARM compiler
It depends on several factors, and your ability to mitigate or change things.
The library can be dropped into the project tree (Add Existing File), and it will link and build completely. Everyone goes to the pub and has a beer.
The linker may complain about options/flags set within the ELF file.
The linker may complain there are other dependencies, for things like GNU/GCC library or helper functions, or functions you simply don't provide.
You might need to change the flags and settings in the file. A working knowledge of ELF files is required for this.
For helper functions you might need to create "shim" functions to map the GNU/GCC names to ARK/Keil names, or provide implementation code for the actual functions required.
You might have to address ABI differences.
Yes when i drop the file to the project using an existing file and build the project some errors are generated: Cannot link object file.o as its attributes are incompatible with the image attributes which flags and settings should i modify in the file.
The ones it is complaining about.
Like I said a working knowledge of ELF and other object files is required as a prerequisite. Lots of documentation out on the interwebs.
Dumping tools like FromELF and objcopy would also allow you to compare and contrast the flags/options export by Keil against those in your file.
Perhaps the developer behind the library provides consultanting and support services?
If the particular library is so critical to your project, why not just use GCC instead?
If using Keil is so critical to your project, find a compatible library (or write from scratch)
Cake; Eat it - choose one.