Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compilation dependency when using static libraries in IAR Embedded Workbench

Tags:

iar

I want to separate my IAR Embedded Workbench workspace into several projects. Currently we have the OS and other code in the same project as the main application but I want the OS and other external code to be static libraries which my application depends on.

I know how to create a static library project and how to add is as a dependency for my executable, but my problem is with the compilation process. It doesn't seem like IAR understands that it must compile the library before the executable. When the library doesn't exist I get an error saying that the file is missing, but it's even worse when the library was compiled once before but some file inside changed. Then the executable compiles without any errors but it uses the OLD library!

Is it possible to make IAR build the static library on its own when it changes? And how about when I have several static libraries and more dependencies?

I had an idea to use a pre-build event, but I was wondering if there's anything out of the box for this situation, and if not what is the best solution.

We're currently using IAR 6, but will probably move to 7 soon.

like image 425
Dina Avatar asked Sep 28 '22 09:09

Dina


1 Answers

I talked to the IAR support. This is the conclusion: - Pre-build events are a valid solution - Batch-build allows you to define an ordered list of projects which all need to be built together and in that specific order - For command line compilation - no support for batch-build (which is defined on the workspace level) - so simply compile separately all the projects in the order they need to be compiled.

Personally I like the batch-build option better than pre-build events because it allows both regular building (i.e. don't build what hasn't changed) and clean rebuilding (from scratch). It's a shame though there's no support for batch-building using command line becasue this makes us define twice in two different places the projects and their ordering...

like image 96
Dina Avatar answered Oct 06 '22 20:10

Dina