rtt设备管理 linux,linux下使用vscode进行rtt的开发教程[支持断点,补全]

本帖最后由 921742079 于 2019-11-20 21:48 编辑

先上图

bf07a307b4846bf11b0026abdb29bcbf.png

下载toolchain

安装openocd,用于调试

sudo apt install gdb-multiarch openocd -y

我是jlink,编写jlink_board.cfg

source [find interface/jlink.cfg]

transport select swd

source [find target/stm32f1x.cfg]

vscode,安装插件

C/C++

Cortex-Debug

C++ Intellisense

复制下面两个文件到项目目录

launch.json, runToMain 如果为false,可以一步步调试rtt的启动流程,为true的话,直接到applications里面的main函数

{

// 使用 IntelliSense 了解相关属性。

// 悬停以查看现有属性的描述。

// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387

"version": "0.2.0",

"configurations": [

{

"name": "openocd_debug",

"cwd": "${workspaceRoot}",

"executable": "${workspaceRoot}/rt-thread.elf",

"request": "launch",

"type": "cortex-debug",

"servertype": "openocd",

"device": "stm32f411ce",

"gdbpath": "/usr/bin/gdb-multiarch",

"configFiles":[

"/home/xxx/dev/embedded/stm32/openocd/stm32f4x/jlink_board.cfg"

],

// "preLaunchTask": "build",

"runToMain": true

}

]

}

tasks.json

{

// See https://go.microsoft.com/fwlink/?LinkId=733558

// for the documentation about the tasks.json format

"version": "2.0.0",

"tasks": [

{

"label": "build",

"type": "shell",

"command": "scons -c; scons"

},

{

"label": "serial",

"type": "shell",

"command": "picocom -b 115200 -s 'sb -vv' -v 'rb -vv' /dev/ttyUSB0"

},

{

"label": "burn",

"type": "shell",

// 请注意修改这里具体的板子配置文件

"command": "openocd -f ~/dev/embedded/stm32/openocd/stm32f4x/jlink_board.cfg -c init -c 'reset halt' -c 'flash write_image erase rtthread.bin 0x08000000' -c 'verify_image rtthread.bin 0x08000000' -c 'reset run' -c shutdown"

},

{

"label": "erase",

"type": "shell",

// 请注意修改这里具体的板子配置文件

// 如果无法erase,请按住板子的reset键,再erase

"command": "openocd -f ~/dev/embedded/stm32/openocd/stm32f4x/jlink_board.cfg -c init -c 'reset halt' -c 'flash info 0' -c 'flash erase_sector 0 0 last' -c 'flash erase_check 0' -c shutdown"

}

]

}按F5, 即可调试

代码补全按F1, edit configurations, 设置includePath

基本上补全,断点,都有了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值