本帖最后由 lovzx 于 2024-9-5 20:31 编辑
终于可以用vscode直接编译下载了,让vscode帮我们输入命令编译烧录,不用在cmd里面输入make了
经过一番尝试小小的配置了只需简单的修改三个地方就可以了
- program参数:需要改为make
- args参数:需要增加-C让make进入指定的工程
- name参数:修改编译配置名字
每次运行的时候会自动弹出来cmd,看着很烦,设置console参数为integratedTerminal就可以了
最后配置如下:
- {
- "configurations": [
- {
- "name": "make编译",
- "type": "cppvsdbg",
- "request": "launch",
- //make文件的绝对地址,这样可以防止和别的环境冲突
- "program": "D:\\msys64\\usr\\bin\\make.exe",
- //原理就是通过参数-C进入指定的目录
- // 烧录就很简单了只需要加上flash和p=端口号就可以了
- "args": [
- "-j8",
- "-C",
- "${workspaceFolder}\\applications\\get-started\\blink"
- ],
- "stopAtEntry": false,
- "cwd": "${workspaceFolder}",
- "environment": [],
- //使用vscode内部的终端输出,不用弹出来终端窗口
- "console": "integratedTerminal"
- },
- {
- "name": "make download",
- "type": "cppvsdbg",
- "request": "launch",
- "program": "D:\\msys64\\usr\\bin\\make.exe",
- "args": [
- "-j8",
- "-C",
- "${workspaceFolder}\\applications\\get-started\\blink",
- "flash",
- //端口号需要改成自己电脑的端口
- "p=COM4"
- ],
- "stopAtEntry": false,
- "cwd": "${workspaceFolder}",
- "environment": [],
- "console": "integratedTerminal",
- },
- {
- "name": "make clean",
- "type": "cppvsdbg",
- "request": "launch",
- "program": "D:\\msys64\\usr\\bin\\make.exe",
- "args": [
- "-j8",
- "-C",
- "${workspaceFolder}\\applications\\get-started\\blink",
- "clean"
- ],
- "stopAtEntry": false,
- "cwd": "${workspaceFolder}",
- "environment": [],
- "console": "integratedTerminal"
- },
- ],
- "version": "2.0.0"
- }
复制代码
|
|