VScode 编译IAR工程

文章介绍了如何在VSCode中不使用插件,而是通过编写批处理文件和调用iarbuild.exe命令来编译IAR工程。步骤包括准备IARIDE,设置环境变量,创建批处理文件,并在VSCode终端中运行该文件进行编译。批处理文件中的iarbuild指令用于控制不同的编译选项,如clean、build和make。作者还对比了使用VSCode插件IARbuild进行编译的情况,两者结果相同。
摘要由CSDN通过智能技术生成

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
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值