IAR作为一款优秀的编译器在代码格式化方面虽然有一个快捷键,但是功能不够丰富,有另外一款专门的代码格式化工具AStyle,我们可以将其嵌入IAR软件来格式化代码
软件下载地址:https://sourceforge.net/projects/astyle/
下载最新的AStyle,下载之后将bin目录下的AStyle.exe放到系统的内
打开IAR软件,选择Tools菜单下Configure Tools..
Menu Text填写上我们期望的名字,我们可以填入格式化代码,command内填入AStyle的地址,
Argument内填入参数: --style=ansi -s4 -S -Y -D -xe -k1 -j -c -xL -p -U $FILE_PATH$
格式化代码的时候将光标定位在准备格式化的文件内部