Build from the command line
Technical Note 47884
This Technical Note shows examples of how to build an IAR Embedded Workbench project from the command line, outside the IDE.
The alternatives below are examples made for IAR Embedded Workbench for Arm, but they can easily be modified for other target devices.
Alternative 1 - Run IarBuild.exe from the command line
If you have a project file named
test.ewp with a configuration named
Debug, the following command can be used to build the project:
<installation dir>\common\bin\IarBuild.exe test.ewp Debug
IarBuild.exe without parameters to get usage information.
To rebuild the project, use the following command (extended with an option to log all compiler messages):
<installation dir>\common\bin\IarBuild.exe test.ewp -build Debug -log all
The rebuild command above corresponds to:
<installation dir>\common\bin\IarBuild.exe test.ewp -clean Debug -log all <installation dir>\common\bin\IarBuild.exe test.ewp -make Debug -log all
Alternative 2 – Compile and link from the command line
You can run all
.exe files in the
<installation directory>\arm\bin folder from the command line. Run each of them, for example
iccarm.exe, without parameters to get a list of available command line options.
To automate the build process, it is possible to create a
.bat file that compiles each source file separately. To see the command line parameters, select the build filter All in the IAR Embedded Workbench IDE:
Right-click in the Build window to select Filter Level: All.
In an older IDE use:
To create a
.bat file that compiles one source file, enter the full path to
iccarm.exe followed by the parameters (copied from the window):
<installation dir>\arm\bin\iccarm.exe <source-file> <options>
When you get the command working for one source file, you can add more commands in the
.bat file for the remaining source files.
When you link, the command line option
-f <file> might be useful. For example:
<installation dir>\arm\bin\ilinkarm.exe -f options.xcl
Place all the linker parameters from the window in the
options.xcl file (make sure to place each parameter on a separate line). Because the linker command line in many cases might be very long, it is recommended to use the
–f option to avoid any problems with command prompt line length.
It is possible to build IAR Embedded Workbench projects from the command line, using
IarBuild.exe, or by invoking IAR C/C++ Compiler and ILINK Linker separately. To read more about command line building, see , under the heading Building from the command line.
All product names are trademarks or registered trademarks of their respective owners.