3

I would like to ask if anybody knows how to create a shared library that could be accessed from 2 projects. The projects are bootloader and application, they both located at the same Cortex-M0 chip and should compile and work under ARM GCC and ARM MDK. The library is quite big (about ~70k). The language is C.

I am using extern declarations, "symdefs" file symbols+addresses (for MDK) and list of PROVIDEs: symbols+addresses (for GCC) to let the linker know about that shared functionality.

The main questions are how to compile that shared library(what options should I use) and how to instruct linker to use that library.

Maybe there is a relative documentation for creating and using a shared library for any of those compilers (for chip applications, not for desktop ones).

I would be grateful if you point me out on that documentation.

ani627
  • 5,578
  • 8
  • 39
  • 45
Anastasiya
  • 31
  • 2
  • The way to compile is pretty much the same as for the executable. But instead of the linker you should invoke the archiver (`ar`) on your object files in order to pack them into a library. – Eugene Sh. Dec 16 '14 at 15:15
  • As I understand your question, you have some code you wish to be accessible by both the boot loader and the main application. The name *shared library* has a fairly strict notion in multi-process OSs. Maybe examine [this question on static linked shared libraries](http://stackoverflow.com/questions/25172834/how-to-create-static-linked-shared-libraries). You may simply need to clear out the library BSS and re-initialize the static data when you transition from boot loader to main app. – artless noise Dec 16 '14 at 16:51

0 Answers0