1.打开vscode安装插件



主要用到IAR for visual studio code,没有使用IAR Embedded workbench,在编译的时候卡住,目前不知道什么原因,可能是IAR的版本过低,7.0版本。

2.打开工程文件夹

会由IAR for visual studio code 这个插件自动生成2个文件:c_cpp_properties.json和iar-vsc.json。如果不能自动识别,手动输入路径

iar-vsc.json

{
"ewp": "c:\\Users\\Administrator\\Desktop\\raspi12\\EWARM\\Project.ewp",
"configuration": "Debug",
"compiler": "C:\\Program Files (x86)\\IAR Systems\\Embedded Workbench 7.0\\arm\\bin\\iccarm.exe",
"workbench": "C:\\Program Files (x86)\\IAR Systems\\Embedded Workbench 7.0"
}

点击Terminal -> RUN TASK,选择iar -> iar:build



会自动生成tasks.json

{
"version": "2.0.0",
"tasks": [
{
"type": "iar",
"command": "build",
"project": "${command:iar-settings.project-file}",
"config": "${command:iar-settings.project-configuration}",
"builder": "${command:iar-settings.workbench}/common/bin/IarBuild.exe",
"label": "iar: Iar Build",
"problemMatcher": [
"$iar-cc",
"$iar-linker"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

3.编译

通过Terminal -> RUN build Task

也可以快捷键 Ctrl + Shift + B 来进行编译

4.调试

调试需要用到一个调试器,这里用到了arm交叉编译工具 gcc-arm-none-eabi。安装,配置环境变量。

直接在文件夹创建launch.json。按Ctrl + space或右下角点add configuration。

选择

需要修改的地方:

 "program": "${workspaceFolder}/EWARM/TEST/Exe/Project.out"    //out路径
"miDebuggerPath": "arm-none-eabi-gdb.exe", //上面安装的交叉编译工具里的调试器,因为加入了环境变量,所以不需要路径
"debugServerPath": "C:/Program Files (x86)/SEGGER/JLink_V502e/JLinkGDBServerCL.exe", //这里使用了j-link进行调试,该路径是安装的j-link驱动的服务路径
"debugServerArgs": "-if swd -singlerun -strict -endian little -speed auto -port 3333 -device STM32F405RG -vd -strict -halt", //这里修改设备名, STM32F405RG

完整的文件:

launch.json

{
"configurations": [
{
"name": "Debug GDBServer",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/EWARM/TEST/Exe/Project.out",
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "arm-none-eabi-gdb.exe",
"debugServerPath": "C:/Program Files (x86)/SEGGER/JLink_V502e/JLinkGDBServerCL.exe",
"debugServerArgs": "-if swd -singlerun -strict -endian little -speed auto -port 3333 -device STM32F405RG -vd -strict -halt",
"serverStarted": "Connected\\ to\\ target",
"serverLaunchTimeout": 5000,
"filterStderr": false,
"filterStdout": true,
"setupCommands": [
{
"text": "target remote localhost:3333"
},
{
"text": "monitor flash breakpoints = 1"
},
{
"text": "monitor flash download = 1"
},
{
"text": "monitor reset"
},
{
"text": "monitor reset"
}
]
}
]
}

最新文章

  1. final评论II
  2. DS实验题 Missile
  3. maven构建带版本号和日期的war包名
  4. 在LaTeX里插入全页的pdf 分类: LaTex 2015-02-04 17:20 142人阅读 评论(0) 收藏
  5. android项目 之 记事本(6)----- 加入手写
  6. Linux - VIM(VI)编辑器
  7. android配置文件详解
  8. AndroidTv Home界面实现原理(一)——Leanback 库的使用
  9. 201521123070 《JAVA程序设计》第3周学习总结
  10. AI - TensorFlow - 张量(Tensor)
  11. Windows的GDI映射方式,逻辑坐标,设备坐标的理解
  12. Codeforces Round #525 (Div. 2) C. Ehab and a 2-operation task
  13. erlang工作总结
  14. tkinter中button按钮控件(三)
  15. ethereum/EIPs-100 挖矿难度计算
  16. 前端基础开发之HTML
  17. Java之IO(十)Reader和Writer
  18. Windows Phone 7 开发环境的搭建
  19. Tomcat SSL配置 Connector attribute SSLCertificateFile must be defined when using SSL with APR解决
  20. Java 读取目录下的所有文件

热门文章

  1. linux ip命令
  2. OpenCV之C++经典案例
  3. css网页布局设置总结
  4. mysql基础问题三问(底层逻辑;正在执行;日志观察)
  5. 关于Window中右键新建菜单的设置
  6. 网易云VIP音乐NCM文件转MP3,C语言版本。
  7. Linu基础 文件IO(读写操作)
  8. HMS Core 3D流体仿真技术,打造移动端PC级流体动效
  9. 用友开发者中心全新升级,YonBuilder移动开发入门指南
  10. [深度学习] Contractive Autoencoder