IAR 命令行编译

> Introduction
This Technical Note shows examples of how to build an IAR Embedded Workbench project from the command line, outside the IDE.

介绍

本技术说明展示了如何在IDE之外从命令行构建IAR嵌入式工作台项目的示例。

> Discussion
The alternatives below are examples made for IAR Embedded Workbench for Arm, but they can easily be modified for other target devices.

讨论

下面的备选方案是针对Arm的IAR嵌入式工作台的示例,但它们可以很容易地针对其他目标设备进行修改。

> Alternative 1 - Run IarBuild.exe from the command line

备选方案1-运行IarBuild.exe从命令行执行

If you have a project file named test.ewp with a configuration named Debug, the following command can be used to build the project:

如果您有一个名为test.ewp的项目文件,配置名为Debug,可以使用以下命令构建项目:

<installation dir>\common\bin\IarBuild.exe test.ewp Debug

<安装目录>\common\bin\IarBuild.exe test.ewp Debug
Note: Run IarBuild.exe without parameters to get usage information.

注意:运行IarBuild.exe不带参数以获取使用信息。

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

备选方案2–从命令行编译和链接
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.

您可以从命令行运行<installation directory>\arm\bin文件夹中的所有.exe文件。运行它们中的每一个,例如iccarm.exe,不带参数以获取可用命令行选项列表。

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 following option in the IAR Embedded Workbench IDE:

为了自动化构建过程,可以创建一个单独编译每个源文件的.bat文件。要查看命令行参数,请在IAR Embedded Workbench IDE中选择以下选项:

Tools > Options > IDE Options > Messages > Show build messages: 'All'.

To create a .bat file that compiles one source file, enter the full path to iccarm.exe followed by the parameters (copied from the View > Messages > Build window):

要创建编译一个源文件的.bat文件,请输入完整路径iccarm.exe,随后是参数(从视图>消息>构建窗口复制):

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

当命令用于一个源文件时,可以在.bat文件中为其余源文件添加更多命令。

When you link, the command line option -f <file> might be useful. For example:

链接时,命令行选项-f<file>可能很有用。例如:

<installation dir>\arm\bin\ilinkarm.exe -f options.xcl
Place all the linker parameters from the Build 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.

将构建窗口中的所有链接器参数放置在options.xcl 文件(确保将每个参数放在单独的行中)。由于链接器命令行在许多情况下可能很长,建议使用–f选项以避免命令提示行长度出现任何问题。

> Conclusion
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 Help > IDE Project Management and Building Guide, under the heading Building from the command line.

结论

可以使用IarBuild.exe从命令行构建IAR嵌入式工作台项目。或者分别调用IAR C/C++编译器和ILINK链接器。要阅读有关命令行构建的更多信息,请参阅帮助>IDE项目管理和构建指南,标题为“从命令行构建”。

原文地址:https://www.iar.com/support/tech-notes/general/build-from-the-command-line/

All product names are trademarks or registered trademarks of their respective owners.
————————————————
版权声明:本文为优快云博主「ee230」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/ee230/article/details/104370630

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值