DAVE TIP of the day: How to build and include a static library?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
In DAVE, you are able to build a static library and include it in a project:

1. Create the library
1a) Go to: >File >New >DAVE Project>Select project type: ARM-GCC Library for XMC Project>Empty Project>Define a "projectname">Select a appropriate Target device>Click "Finish"
1b) Create a source file with your library functions
1c) Build the project --> The library file "lib".a can be found in the artifact folder.

2. Include the library in a project
2a) Create an application project (e.g. empty main)
2b) Declare the library functions with extern reference
2c) Change project properties:
Go to: >Project>Active Project Properties>C/C++ Build >Settings>ARM-GCC C Linker>Libraries>Add "" in "Libraries (-l)" window>Add "path to Lib.a" in "Library search path (-L)" window
0 Likes
7 Replies
Not applicable
Even if the post is almost two years old I have a question: With my DAVE 3 I'm not able to generate a static library respectivly there is a strange behaviour: The checkbox "Show project types and toolchains only if they are supported on the platform" is enabled. And then I cannot create a "ARM-GCC Library for XMC Project.
Can anybody tell me why I shouldn't be able to create a static library?

Kind regards
Sebastian
0 Likes
lock attach
Attachments are accessible only for community members.
Not applicable
Hi Sebastian,

In Step 1a, please ensure that you have selected. If you selected otherwise, the lib will not be generated.
1a: Go to: >File >New >DAVE Project>Select project type: ARM-GCC Library for XMC Project>Empty Project>Define a "projectname">Select a appropriate Target device>Click "Finish"

Attached in this reply is a project created in DAVE v3.1.10 using the steps above to create and use a static library for your reference.


Regards,
Daryl 🙂
0 Likes
User8620
Level 2
Level 2
I dont understand the last step.
Which paths do I have to set to include the library?
At the moment I get a strange error:
"../arm-gcc-49/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld.exe: warning: cannot find entry symbol Reset_Handler; defaulting to 08000000"


Lets say I have a Library called "ExampleLibrary". I build the library and get a "libExampleLibrary.a" file in my the Project debug folder.
I have another Application project called "Test", where i go unter Properties> C/C++ Build >Settings>ARM-GCC C Linker>Libraries
In Library (-l) i add "libExampleLibrary.a" (without the ")
In Library search Path (-L) I add "C:\Workspaces\DAVE-4.2-64Bit\WS_2015_03_02\ExampleLibrary\Debug\"

But all I get is the error I mentioned above.
I changed both values, but then I get a different error that the library can not be found.
0 Likes
Not applicable
Hi,

Let's use your example.
Library project : ExampleLibrary
Library:libExampleLibrary.a
Location of library: c:\project\examplelibrary\debug\

Application Project to use the library: Test

Here's what you need to configure.

2c) Change project properties:
Go to: >Project>Active Project Properties>
In the opened dialog, goto C/C++ Build >Settings -> ARM-GCC C Linker -> Libraries -> Add "ExampleLibrary"
Next in "Libraries (-l)" window -> Add "path to Lib: "c:\project\examplelibrary\debug"

Once this is done, you should be able to compile your code using the library in your project.

Regards,
Daryl
0 Likes
User12216
Level 2
Level 2
First like received
I am able to get the code to compile and link just fine and I am able to debug it with DAVE 4.3.2. However, I have two remaining questions:

1. Since my main application is set "Active", the library project is not active but it is open. How do I get DAVE not to "gray out" the source code when I view and modify the library source?

2. If I modify the library source, how do I get DAVE to automatically compile the necessary library code when I build my active application project?

Thanks in advance.
0 Likes
User11187
Level 2
Level 2
Thank you Daryl,

What if I would use an external static library using C++?
In particular i would define some classes in a static library and use them in a C++ project

Thank you

Matteo
0 Likes
User15030
Level 1
Level 1
Hallo,

I have problem give official library of Infineon webside to Dave Studio. if copy this folder to exist project. Compiler write errors. i need math function what are inside arm_math.

I am from this verry bad 😞 😞

please show me how i give inside libraries in picture
0 Likes