Keil Logo

compile a (.a) library created with GNU compiler using keil

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Author
Rania Salim
Posted
27-Sep-2018 21:07 GMT
Toolset
ARM
New! compile a (.a) library created with GNU compiler using keil

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?

Author
Westonsupermare Pier
Posted
27-Sep-2018 22:44 GMT
Toolset
ARM
New! RE: compile a (.a) library created with GNU compiler using keil

>>is it possible to compile it with ARM compiler?
Do you have the source? Does it contain any GNU specific coding?

Author
Rania Salim
Posted
28-Sep-2018 14:22 GMT
Toolset
ARM
New! RE: compile a (.a) library created with GNU compiler using keil

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

Author
Andrew Neil
Posted
28-Sep-2018 16:38 GMT
Toolset
None
New! Back to basics.

"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?"

Author
Rania Salim
Posted
28-Sep-2018 16:51 GMT
Toolset
None
New! RE: Back to basics.

Yes i mean Link a gcc .a library to a keil project which will be compiled with ARM compiler

Author
Westonsupermare Pier
Posted
28-Sep-2018 22:51 GMT
Toolset
None
New! RE: Back to basics.

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.

Author
Rania Salim
Posted
4-Oct-2018 19:16 GMT
Toolset
None
New! RE: Back to basics.

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.

Author
Westonsupermare Pier
Posted
4-Oct-2018 19:33 GMT
Toolset
None
New! RE: Back to basics.

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?

Author
Andrew Neil
Posted
4-Oct-2018 20:56 GMT
Toolset
None
New! Maybe time to rethink?

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.

Next Thread | Thread List | Previous Thread Start a Thread | Settings

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.