Not applicable
May 14, 2013
03:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 14, 2013
03:17 PM
Hello,
I would like know how to build a static library with Dave and how to link it with another project.
I have tried to make a new ARM-GCC Library for XMC4500 Project and after add the include and source files I have compiled the code.
Then from the properties of the main project on Settings->ARM-GCC C Linker->Libraries I have added the name of the library in Libraries (-l). After that I have compiled the main code without any error but when the flow of the program arrives to a function of the linked library, the debugger stops working and appears one message saying that the compiler can't find the library.
For other hand, I have tried to build a static library from a Empty Project. From properties menu of the new project on Settings->ARM-GCC C Linker->Miscellaneous I have added the next flags "-shared -fPIC -DPIC" but when I have compiled the project I get the next error.
c:/dave-3.1/arm-gcc/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/bin/ld.exe: library.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
Anyone had built before a static library? I will be so grateful if someone tells me the steps to do it.
Thanks in advance and best regards,
MagicPhoton
I would like know how to build a static library with Dave and how to link it with another project.
I have tried to make a new ARM-GCC Library for XMC4500 Project and after add the include and source files I have compiled the code.
Then from the properties of the main project on Settings->ARM-GCC C Linker->Libraries I have added the name of the library in Libraries (-l). After that I have compiled the main code without any error but when the flow of the program arrives to a function of the linked library, the debugger stops working and appears one message saying that the compiler can't find the library.
For other hand, I have tried to build a static library from a Empty Project. From properties menu of the new project on Settings->ARM-GCC C Linker->Miscellaneous I have added the next flags "-shared -fPIC -DPIC" but when I have compiled the project I get the next error.
c:/dave-3.1/arm-gcc/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/bin/ld.exe: library.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
Anyone had built before a static library? I will be so grateful if someone tells me the steps to do it.
Thanks in advance and best regards,
MagicPhoton
4 Replies
May 23, 2013
12:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 23, 2013
12:27 PM
It should work as follows:
1. Create the library
>File >New >DAVE Project
Select project type: ARM-GCC Library for XMC Project >Empty Project
Define a name
Select a appropriate target device and finish
Create a source file and add your library functions
Build the project
In the artifact folder you should find the library file: lib.a
2. Use the created library
Create an application project (e.g. empty main)
Use in the source files the library functions (declare with extern reference)
Change project properties in C/C++ Build >Settings ->ARM-GCC C Linker -> Libraries:
Add –l option (Libraries):
Add –L option (Library search path): path to Lib.a
1. Create the library
>File >New >DAVE Project
Select project type: ARM-GCC Library for XMC Project >Empty Project
Define a name
Select a appropriate target device and finish
Create a source file and add your library functions
Build the project
In the artifact folder you should find the library file: lib
2. Use the created library
Create an application project (e.g. empty main)
Use in the source files the library functions (declare with extern reference)
Change project properties in C/C++ Build >Settings ->ARM-GCC C Linker -> Libraries:
Add –l option (Libraries):
Add –L option (Library search path): path to Lib
Not applicable
Nov 28, 2014
05:58 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 28, 2014
05:58 PM
Huba, i follow your steps to make and include the library,still errors as MagicPhoton Descripbed. Could you give a staic_lib_example Code and a project to call the static_lib ?
Not applicable
Dec 01, 2014
05:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 01, 2014
05:00 PM
Anybody Can help Me?
Attachments are accessible only for community members.
Not applicable
Dec 01, 2014
11:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 01, 2014
11:26 PM