赞
踩
gcc-arm-none-eabi\bin
OpenOCD\bin
建议MinGW-make工具重命名为make.exe并添加到gcc-arm-none-eabi\bin路径
测试工具环境变量是否生效
arm-none-eabi-gcc -v
OpenOCD -v
make -v
使用cubeMX创建Makefile工程
Makefile:由于window没有rm指令,所以这里修改为 del,并添加了系统判断
将makefile一下
-------------------------------
clean:
-rm -fR $(BUILD_DIR)
-------------------------------
修改
-------------------------------
ifeq ($(OS),Windows_NT)
clean:
del $(BUILD_DIR)
else
clean:
-rm -fR $(BUILD_DIR)
endif
-------------------------------
调试器配置
OpenOCD\share\openocd\scripts\interface\stlink-v2.cfg
芯片配置
OpenOCD\share\openocd\scripts\target\stm32f7x.cfg
创建任务脚本
F1
输入 tasks
选择 运行任务
选择 配置任务
选择 使用模板创建task.json
选择 other
选择创建 tasks
使用任务脚本
CTRL + SHIFT + B 选择对应的任务
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
//make 任务
{
"label": "build",
"type": "shell",
"command": "make",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
// clean 任务
{
"label": "clean",
"type": "shell",
"command": "make clean",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
//下载任物
{
"label": "download",
"type": "shell",
"command": "openocd",
// openocd 传递的参数
"args": [
"-f",
"stlink-v2.cfg",
"-f",
"stm32f7x.cfg",
"-c",
"program build/stm32f767_project.elf verify reset exit",
],
"group": {
"kind": "build",
"isDefault": true
},
},
]
}
1.创建调试脚本
选择调试窗口
选择 创建 launch.json 文件
2. 启用调试
快捷键 F5
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Cortex Debug",
"cwd": "${workspaceFolder}",
"executable": "${workspaceFolder}/build/stm32f767_project.elf", // 编译文件
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"interface":"swd",
"device": "STM32F7IGT6",
"configFiles": [
"stlink-v2.cfg",
"stm32f7x.cfg",
]
}
]
}
调试过程中报错:仔细查看报错信息,gcc版本过低也会造成调试报错
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。