习惯了vscode + cmake+ cortex-debug进行项目开发·······
无奈好多国产MCU不在jflash设备列表,但是都有keil支持包!
1. jflash添加设备即可
JFlash添加芯片_大白菜价的博客-CSDN博客_jflash添加芯片型号
添加完设备,可以调试了,但是发现通过elf文件下载的程序不完整,无法运行·····
曲线救国,先调用jflash下载hex,再调试
2.
构建jflash下载的task
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "jlink_download",
"type": "shell",
"command": "D:/software/SEGGER/JLink/JLink.exe -autoconnect 1 -device CMS32F55xx -if swd -speed 1000 -commandfile download.jlink",
"problemMatcher": []
}
]
}
建立一个文件download.jlink
文件内容
erase
loadfile ./build/XXXX.hex
qc
OK
cortex-debug配置文件把设备写成Cotex-M0,这样cortex-debug就因为找不到下载算法二不进行下载程序
加入启动调试前任务即可
"preLaunchTask": "jlink_download"
实测,一切OK
*************************************************************************************************
keil支持cmd调用,所以,在cortex-debug调试前调用keil下载程序即可!
建立一个此芯片的剋了工程
直接上task吧。
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "rm",
"type": "shell",
"command": "rm -r ./MDK-ARM/Objects/*.axf"
},
{
"label": "copy",
"type": "shell",
"command": "copy ./build/BLDC.elf ./MDK-ARM/Objects/FM33_BLDC.axf",
"dependsOn": [
"rm"
]
},
{
"label": "keil_download",
"type": "shell",
"command": "D:\\software\\KEIL\\UV4\\UV4.exe -f ./MDK-ARM/FM33_BLDC.uvprojx -j0",
"dependsOn": [
"copy"
]
},
]
}
BLDC.elf cmake编译的文件名称
FM33_BLDC.axf keil生产的文件名称
在launch加入"preLaunchTask": "keil_download",就可以!