infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Results 1 to 8 of 8

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

  1. #1
    Advanced Advanced sophia is on a distinguished road
    Join Date
    Nov 2011
    Posts
    678
    Points
    2190

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

    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<projectname>".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 "<projectname>" in "Libraries (-l)" window>Add "path to Lib<projectname>.a" in "Library search path (-L)" window

  2. #2
    Sebastian83 is on a distinguished road
    Join Date
    Jun 2015
    Posts
    36
    Points
    132.5
    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

  3. #3
    Advanced Advanced Daryl Neo is on a distinguished road
    Join Date
    Nov 2011
    Location
    Singapore
    Posts
    373
    Points
    3468.75
    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
    ?????

  4. #4
    Beginner Beginner oliver.blasius is on a distinguished road
    Join Date
    May 2014
    Posts
    20
    Points
    66.328125
    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.

  5. #5
    Advanced Advanced Daryl Neo is on a distinguished road
    Join Date
    Nov 2011
    Location
    Singapore
    Posts
    373
    Points
    3468.75
    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

  6. #6
    Beginner Beginner prcarp is on a distinguished road
    Join Date
    Sep 2016
    Location
    Virginia, USA
    Posts
    15
    Points
    93.75
    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.

  7. #7
    Beginner Beginner ermes is on a distinguished road
    Join Date
    Feb 2016
    Posts
    16
    Points
    101.25

    C++ static library?

    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

  8. #8
    Beginner Beginner hessman is on a distinguished road
    Join Date
    May 2018
    Location
    Czech Republic
    Posts
    5
    Points
    70

    Include libraries to DAVE studio XMC_Peripheral_Library_v2.1.18

    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

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.