VScode 编译IAR工程

VScode 编译IAR工程

前言

利用VSCode的终端直接编译已经创建好的IAR工程,网上很多教程都是通过VSCode 的插件进行IAR工程编译。下面说一种不通过插件的方式,直接通过VSCode的终端进行编译的方式。


一、准备工作

  1. 安装好IAR这个IDE,如何安装网上很多教程
  2. 设置环境变量
    iarbuild.exe目录
    在这里插入图片描述
  3. 写好编译脚本,这个比较简单

二、使用步骤

1.bat批处理文件

批处理文件使用到的指令如下:

iarbuild [-clean | -build | -make | -cstat_analyze | -cstat_clean]
[-log errors|warnings|info|all] [-parallel ] [-varfile ]
Parameter: Description:

Your IAR Embedded Workbench project file (project.ewp).

-clean Removes any intermediate and output files.

-build Rebuilds and relinks all files in the current
build configuration.

-make Brings the current build configuration up to date
by compiling, assembling, and linking only the files
that have changed since the last build.

-cstat_analyze Analyzes the project using C-STAT and generates
information about the number of messages.
For more information, see the C-STAT Static Analysis Guide.

-cstat_clean Cleans the C-STAT message database for the project.
For more information, see the C-STAT Static Analysis Guide.

The name of the configuration you want to process,
which can either be one of the predefined configurations
Debug or Release, or a name that you define yourself.
By using a comma separated list it is possible to
process multiple configurations.
Using * (wild card character), all configurations
defined in the project will be processed.

-log errors Display build error messages.

-log warnings Display build warning and error messages.

-log info Display build warning and error messages, and messages
issued by the #pragma message preprocessor directive.

-log all Display all messages generated from the build,
for example compiler sign-on information and the
full command line.

-parallel Specifies the number of parallel processes to run the
compiler in to make better use of the cores in the CPU.

-varfile Makes custom argument variables defined in a workspace
scope available to the build engine by specifying the
file to use.

示例:

	iarbuild.exe example\uart\uart_int\EWARM\uart_int.ewp -%1 debug -log info -parallel 4

简单来说就是调用iarbuild.exe,后面跟着IAR工程名,接着一些配置,其中%1表示输入的参数可以是build、make、clean,debug表示编译debug的版本,这个参数如下图设置,选择需要编译的
在这里插入图片描述
这里不做其他详细介绍,目前有些东西也在摸索中。

为了方便我直接将批处理文件放在了VSCode打开的文件夹路径下,这个路径可以随便放,我的如下:
在这里插入图片描述

2.使用方法

  1. VSCode通过CTRL + ~打开终端,如下图,我打开后是下面界面
    在这里插入图片描述
  2. 调用批处理文件,使用参数使用的build
    在这里插入图片描述
  3. 编译完成
    在这里插入图片描述

三 、对比使用VSCode插件编译

在这里插入图片描述
我使用的是IAR build这个插件,通过这个插件,编译出来的与使用批处理编译出来是一样的


总结

主要是记录下使用方法,有什么不对的地方,请大家指正,谢谢!

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
要在VSCode编译IAR 8.32工程,需要进行以下步骤: 1. 安装适当的插件:在VSCode的扩展市场中,搜索并安装C/C++和IAR Embedded工具链插件。 2. 打开工程:在VSCode中,点击“文件”菜单,选择“打开文件夹”,然后选择IAR 8.32工程所在的文件夹。 3. 配置编译器:检查IAR Embedded工具链插件的设置是否正确。点击“文件”菜单,选择“首选项”,然后点击“设置”。在设置中搜索“C_Cpp.default.intelliSenseMode”,确保设置为“iar”。 4. 配置任务:点击“查看”菜单,选择“终端”,在终端中选择“新终端”选项。然后在终端中运行“Ctrl + Shift + P”快捷键,输入“Configure Default Build Task”并选择相应的选项。选择“其他”配置,然后在.vscode文件夹下创建一个名为tasks.json的文件,编辑该文件以配置编译任务。 5. 配置任务文件(tasks.json):在tasks.json文件中,使用适当的参数配置任务,例如配置工作目录、编译命令等。确保将编译命令调整为IAR的工具链命令,并将输出目录设置为期望的目录。 6. 运行编译任务:在VSCode中,按下“Ctrl + Shift + B”快捷键选择已配置的编译任务,或者使用命令面板(Ctrl + Shift + P)运行“Tasks: Run Build Task”命令,选择相应的编译任务进行编译。 7. 查看编译结果:在编译完成后,可以查看编译输出结果以及可能出现的错误信息等。 以上是在VSCode编译IAR 8.32工程的简要步骤,根据具体的软件配置和工程要求,可能需要其他额外的配置和操作。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值