使用VSCode的Cortex Debug调试任意固件
版权声明:转载需注明来自于 vllogic.com
前言:除了常见调试外,这个方法还适用于多个软件通过单个
Vllink同时访问SOC上的多个JTAG设备
标准配置方法 可跳过
安装
VSCode在
VSCode中安装Cortex-Debug插件,安装完成后关闭VSCode下载并解包OpenOCD
在系统
PATH中增加:{GCC的绝对路径}\gcc-arm-none-eabi_10-2021-10\bin{OpenOCD的绝对路径}\openocd\bin
进入需要调试的工程目录,执行构建,生成
.out或.axf可调试文件新建
vscode_cortex_debug文件夹进入
vscode_cortex_debug文件夹,新建.vscode文件夹新建
vscode_cortex_debug.code-workspace文本,填入以下内容{ "folders": [{"path": "."}], "settings": {"cortex-debug.variableUseNaturalFormat":false} }
进入
.vscode文件夹,新建launch.json文本,此处提供几个模板,合理修改后保存模板一:雅特力 AT32F405
{ "version": "0.2.0", "configurations": [ { "name": "Cortex Debug", "cwd": "${workspaceFolder}", "executable": "../objects/flash_write_read.axf", "request": "launch", "type": "cortex-debug", "runToEntryPoint": "main", //"gdbPath": "../vscode_cortex_debug.tools/arm-none-eabi-gdb.exe", "servertype": "openocd", //"serverpath": "../vscode_cortex_debug.tools/openocd/bin/openocd.exe", "device": "AT32F405", "configFiles": [ "interface/cmsis-dap.cfg", "target/at32f405xx.cfg" ] } ] }
模板二:爱科微 AIC8800M
{ "version": "0.2.0", "configurations": [ { "name": "Cortex Debug", "cwd": "${workspaceFolder}", "executable": "../project/Exe/project.out", "request": "launch", "type": "cortex-debug", "runToEntryPoint": "main", //"gdbPath": "../vscode_cortex_debug.tools/arm-none-eabi-gdb.exe", "servertype": "openocd", //"serverpath": "../vscode_cortex_debug.tools/openocd/bin/openocd.exe", "device": "AIC8800M", "configFiles": [ "interface/cmsis-dap.cfg", "target/aic8800.cfg" ] } ] }
双击
vscode_cortex_debug.code-workspace打开工程,按F5即启动调试
解包即用版本
安装
VSCode在
VSCode中安装Cortex-Debug插件,安装完成后关闭VSCode进入需要调试的工程目录,执行构建,生成
.out或.axf可调试文件下载整合包,此包集成
AT32F405、AIC8800M、H7P20调试工程以及必要的GDB、OpenOCD二进制文件解压整合包,根据目标芯片打开对应的调试工程,如:
vscode_cortex_debug.H7P20/vscode_cortex_debug.code-workspace。把
launch.json中的"executable"路径修改为可调试文件的相对路径,如是其他芯片,还需要修改"device"项及"configFiles"项按
F5即启动调试