Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IAR Embedded workbench create library

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.

like image 772
Teo Avatar asked Jun 24 '13 19:06

Teo


2 Answers

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.

like image 131
andy mango Avatar answered Oct 17 '22 14:10

andy mango


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.

like image 32
ted Avatar answered Oct 17 '22 14:10

ted