IAR Embedded workbench create library
Asked Answered
O

2

6

I want to create a simple library (C/ANSI) in IAR Embedded Workbench and then use the library in another project. I found some documentation on their website. Although I do not understand it entirely, I managed to make myself a .r90 file and from what I understand that would be the library. Please note that I am a complete beginner in this area. In conclusion I would like a step-by-step description on how to create a library and then how to import it in another project. Thanks.

PS: I am using IAR Embedded Workbench for AVR and this version does not have the Library tab under Linker.

Ohmmeter answered 24/6, 2013 at 19:41 Comment(0)
B
9

Briefly.

  1. Bring up the Options for the library project.
  2. Under the "General Options" selection, choose the "Output" tab.
  3. Within the "Output" tab you will find an "Output file" selection that can be either Executable or Library.
  4. For the library project, choose library.
  5. Within the project that is to link against the library, open the Options for that project.
  6. Select the "Linker" options and choose the "Library" tab.
  7. Under the Library tab you will find an entry box labeled, "Additional libraries (one per line). Type the path to the library that you created into the entry box.

This will work for the ARM flavor. Other targets or versions of the Embedded workbench may vary.

Bedroll answered 24/6, 2013 at 20:29 Comment(3)
I do not have any "Library" tab under "Linker"Ohmmeter
In that case look for an "Extra Options" tab and you can enter the path name of the library there. So just which flavor of IAR Embedded Workbench are you using?Bedroll
I usually just add the .a output file to the project hierarchy and this will link in that library.Marceau
C
7

Steps for IAR workbench 6.20.

  1. Creating Library

    1.1 Created a new project from (Project -> Create new project)

    1.2 Project In C with main is selected
    1.3 I removed the main.c from the project by right clicking on main.c in the workspace box (left to the coding Area)
    1.4 Add the code and Open the options from Project -> Options (Alt + F7), Select the General Options in category and select output tab in right side.
    1.5 Select "Library" from output tab.
    1.6 Build it.

  2. Adding to Another Project
    2.1 Create and new project and go to the IDE.
    2.2 Right click on the workspace in the left side of IDE and add the r90 file of the library from Exe folder(Default output folder IAR) to the project by selecting option "Add files"

After the last step I believe that you can call the functions in you library from the new project. If you include the extern declarations for the functions and variables you can avoid the declared implicitly warning.

Congruent answered 9/7, 2013 at 13:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.