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
.
Briefly.
This will work for the ARM flavor. Other targets or versions of the Embedded workbench may vary.
Steps for IAR workbench 6.20.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With