不少时候用IAR开发都是基于已有工程模板开发的,可是工程模板的名称常常让人头疼;如下是修改办法:编程
从一个实例工程复制后缀名为“dep,ewd,ewp,eww”的四个文件,并将其重命名为app
你本身的名字,如:enddev_module.dep,enddev_module.ewd,enddev_module.ewp,enddev_module.eww。函数
修改右键打开enddev_module.eww文件,并修改该文件中的中的“<path>$WS_DIR$\enddev_module.ewp</path>”成你须要的工程名字。工具
至此,工程能够正常运行了,可是有些输出仍是原工程的名称:spa
link->output中修改便可。3d
修改后从新MAKE一下结果显示code
至此,整个工程修改完美。blog
在代码段点击右键,找到tools->Option,将上面的Tab Size设置为4,Index Size 也设置为4,这样就能够实现直接按Tab键就能够缩写4(space键)个空格。ip
这样设置就不会有由于TAB键致使在其余编译器等环境下,代码的良莠不齐了。
Default character 选中UTF-8,不跟随系统,怕在不一样系统之间乱码问题;
EOL characters 选择PC或者UNIX;这个看你的系统;在使用BCompare等文件比较工具时,这个PC格式仍是UNIX是作区分的,一样的文件因为系统不一样致使文件格式不一样,BCompare比较时就会显示文件不相等,可是去merge时发现里面内容是相同的,此时就能够用选项这个来转换了。
代码模板有利于快速输入代码,提升编程效率;特别是不少公司对代码风格统一要求比较严格,当你每次提交代码给伙伴re-view时不少时候要求修改的仅仅是一些风格问题,创建合适的模板能很快的。在IAR中能够Code Templates来显示代码模板的创建与应用。如下是操做步骤:、
菜单路径:Edit -> Code Templates -> Edit Templates
进入一个名为<CodeTemplates.ENU.txt>的文件,全部的模板只要在该文件下设置修改就行了。使用快捷键:在你所要编程的文件下,按Ctrl+Alt+V将弹出对应的对话框,选择设置好的模板,以下图:
如下是本人日常用的模板库,file和fuction模板格式是能够经过软件导出函数API文档的。用这个模板给API文档设计也能够少写不少哦。
################################################################################
##
## This is an example file for defining your own code templates.
##
## The syntax for defining a code template is:
## #TEMPLATE <template name>,<field>[=default value], <field>...
##
## The template name, the fields and their default values should be defined
## within quotes if they contain non-alphanumeric characters.
## Use "&" in front of a letter in the template name to make the letter become
## a shortcut, which means that you can use ALT+<letter> to select the template
## or jump to the field in the dialog box.
## Use ">" in the template to organize the template names in submenus.
## "&Statement>&if"
################################################################################
#TEMPLATE &File
/**
******************************************************************************
* @file : $FILE_FNAME$
* @author : $USER_NAME$
* @version : V 1.0.0
* @date : $DATE$
******************************************************************************
* @brief --
*
*
******************************************************************************
*/
#TEMPLATE &Function,"Function &name",&FucDescription= --,"Input ¶meter",&InputDescription=--,"Out ¶meter",&OutDescription=--,&Created="$DATE$, by $USER_NAME$"
/*******************************************************************************
* @brief %1():%2
* @param %3
* %4
* @retval %5:%6
* Author: %7
*******************************************************************************/
%5 %1(%3)
{
%c
}
#TEMPLATE "&if"
if ( %c ) {
}
#TEMPLATE &for,"&End Value"=10,&Variable=i, &Type
for (%3 %2 = 0; %2 < %1; ++%2) {
%c
}
#TEMPLATE &class,"Class &name",&Description=--,&Created="$DATE$, by $USER_NAME$"
/*******************************************************************************
* CLASS: %1
* DESCRIPTION:%2
* CREATED: %3
* FILE: $FILE_FNAME$
*******************************************************************************/
class %1
{
public:
%1();
~%1();
%c
};
以上内容能够所有拷贝并替换<CodeTemplates.ENU.txt>文件中的内容
其中的File、Function … 是本人本身设置的模板,选中一个将弹出模板界面,这里以Function界面为例:如图
按模板填写内容便可,点击“OK”后导出的函数就彻底符合公司的需求了(前提是模板按公司的需求来写)。