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.
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...
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