“无法开始调试。没有进程与此对象关联。” -在Visual Studio Code中具有GDB和openOCD的STM32F4

时间:2018-10-13 21:04:21

标签: c++ visual-studio-code gdb mbed openocd

Windows 10
VSCode 1.28.1
VSC CPP工具扩展0.19.0
开发板:Multitech MTUDK2-ST
OpenOCD 0.10.0
GDB(作为GNU ARM工具链的一部分的2.12.1.20170417.git 6-2017-q2-update)

尝试为此setup/example进行调试。使用Mbed CLI(1.8.2)编译二进制文件在命令提示符下工作正常。也可以在一个命令提示符实例中成功启动openOCD并在VS Code终端会话(由arm-none-eabi-gdb启动)上通过GDB会话与之通信。

启动调试会话会在VSC调试控制台上生成以下输出:

1: (628) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'

1: (667) LaunchOptions  ExePath='Z:\VoboNode_vsc_nucleo_f411RE\VoBoNode\BUILD\MTS_MDOT_F411RE\GCC_ARM-DEBUG\VoBoNode.elf'

1: (667) LaunchOptions  WorkingDirectory='Z:\VoboNode_vsc_nucleo_f411RE\VoBoNode'

1: (667) LaunchOptions  ExeArguments=''

1: (667) LaunchOptions MIMode='gdb'

1: (667) LaunchOptions  MIDebuggerPath='C:\Program Files (x86)\GNU Tools ARM Embedded\6 2017-q2-update\bin\arm-none-eabi-gdb.exe'

1: (667) LaunchOptions  WaitDynamicLibLoad='false'

1: (667) LaunchOptions  DebugServer='C:\OpenOCD\openocd-0.10.0\bin\openocd.exe'

1: (667) LaunchOptions  DebugServerArgs='-f C:\OpenOCD\openocd-0.10.0\scripts\board\st_nucleo_f4.cfg -f C:\OpenOCD\openocd-0.10.0\scripts\interface\stlink-v2-1.cfg -c init -c "reset init"'

1: (667) LaunchOptions  ServerStarted='target halted due to debug-request, current mode: Thread'

1: (667) LaunchOptions  FilterStderr='true'

1: (667) LaunchOptions  ServerLaunchTimeout='20000'

1: (667) LaunchOptions>

1: (667) LaunchOptions    <SetupCommands>

1: (668) LaunchOptions        <Command IgnoreFailures='false' Description=''>-environment-cd Z:\VoboNode_vsc_nucleo_f411RE\VoBoNode\BUILD\MTS_MDOT_F411RE\GCC_ARM\</Command>

1: (668) LaunchOptions        <Command IgnoreFailures='false' Description='connect to target'>-target-select remote localhost:3333</Command>

1: (668) LaunchOptions        <Command IgnoreFailures='false' Description='load file'>-file-exec-and-symbols VoBoNode.elf</Command>

1: (668) LaunchOptions        <Command IgnoreFailures='false' Description=''>-interpreter-exec console "monitor endian little"</Command>

1: (668) LaunchOptions        <Command IgnoreFailures='false' Description=''>-interpreter-exec console "monitor reset"</Command>

1: (668) LaunchOptions        <Command IgnoreFailures='false' Description=''>-interpreter-exec console "monitor halt"</Command>

1: (668) LaunchOptions        <Command IgnoreFailures='false' Description=''>-interpreter-exec console "monitor arm semihosting enable"</Command>

1: (668) LaunchOptions        <Command IgnoreFailures='false' Description='flash target'>-target-download</Command>

1: (668) LaunchOptions    </SetupCommands>

1: (668) LaunchOptions</LocalLaunchOptions>

1: (806) Starting: "C:\OpenOCD\openocd-0.10.0\bin\openocd.exe" -f C:\OpenOCD\openocd-0.10.0\scripts\board\st_nucleo_f4.cfg -f C:\OpenOCD\openocd-0.10.0\scripts\interface\stlink-v2-1.cfg -c init -c "reset init"

1: (1007) "C:\OpenOCD\openocd-0.10.0\bin\openocd.exe" exited with code 1 (0x1).

1: (1023) <-logout

请注意,使用“开始:”(第806行)之后显示的确切命令行来手动启动openOCD可以正常工作。我怀疑SetupCommands(多行668)有问题,这阻止了OpenOCD会话的启动。无论如何,我不确定要如何从手动启动的GDB会话提示中执行OP的GDB命令,因此我很难进行故障排除。

1 个答案:

答案 0 :(得分:0)

使其正常工作。 VS Code构建要加载进行调试的位置中似乎存在先前构建内容的问题。删除整个文件夹并允许VS Code通过新版本重新填充它,可以解决openOCD错误。现在,即使我没有从以前的版本中删除内容,该版本也可以正常工作。不能完全确定为什么这样做有效,但确实可以。