使用环境
<!-- 必须 告知插件运行的环境,帮助开发者定位问题 -->
- 操作系统版本:Windows10
- 操作系统平台(x86/x64):x86
- VsCode 版本:latest stable
- EIDE 插件版本:latest stable
- C/C++ 插件版本:latest stable
- 何种编译器(keil_c51/sdcc/armcc5/armgcc/...):gcc-arm
- 编译器版本(非编译问题可忽略):
描述问题
<!-- 使用简明清晰的语言描述您的问题 -->
企图达到一键编译烧录调试的目的, 使用了 launch.json, 添加 preLaunchTask 后不能正常烧录,手动编译烧录调试(按顺序)毫无问题, 推测在烧录步骤完成前就加载了gdbserver导致烧录端口被占用.
屏幕截图
<!--使用一些截图能够更好地展现问题 -->
launch.json
{
"cwd": "${workspaceRoot}",
"preLaunchTask": "build and flash",
"type": "cortex-debug",
"request": "launch",
"name": "DEBUG",
"servertype": "openocd",
"executable": "build\\Debug\\${workspaceFolderBasename}.elf",
"runToEntryPoint": "main",
"configFiles": [
"interface/stlink.cfg",
"target/stm32f4x.cfg"
],
"svdFile": "src/STM32F429.svd"
}
gdb调试会话(连接成功)先于烧录任务执行,导致烧录失败
* 正在文件夹 new 中执行任务: ""C:\Users\Wike Chao\.eide\tools\openocd_7a1adfbec_mingw32\bin\openocd.exe" -s "c:\Users\Wike Chao\code\EIDE\new" -f interface/stlink.cfg -f target/stm32f4x.cfg -c "program \"c:/Users/Wike Chao/code/EIDE/new/build/Debug/new.hex\" verify" -c "reset run" -c "exit""
Open On-Chip Debugger 0.12.0-rc2-g7a1adfbec (2022-11-06-10:08)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 2000 kHz
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Error: open failed
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked
期望现象
<!--您期望应该产生的,但实际上却没有发生的结果-->