0
votes

Windows 10
VSCode 1.28.1
VSC CPP Tools Extension 0.19.0
Development board: Multitech MTUDK2-ST
OpenOCD 0.10.0
GDB (7.12.1.20170417.git as part of GNU ARM toolchain 6-2017-q2-update)

Attempting to debug per this setup/example. Compiling binary with Mbed CLI (1.8.2) works fine from command prompt. Also can successfully launch openOCD in one command prompt instance and communicate with it over GDB session on VS Code terminal session (launched with arm-none-eabi-gdb).

Launching the debug session generates the following output on the VSC Debug Console:

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

Note that using the exact command line shown after "Starting:" (line 806) to manually start openOCD works fine. I suspect there is a problem with the SetupCommands (multiple lines 668) which is preventing the OpenOCD session from starting. Regardless, I am not exactly sure how the OP's GDB commands are supposed to be executed from a manually launched GDB session prompt so it is difficult for me to troubleshoot.

1

1 Answers

0
votes

Got it working. It appears to have been an issue with content from previous builds being present in the location the VS Code build looks for to load for debugging. Deleting the entire folder and allowing VS Code to repopulate it through a new build resolved the openOCD error. And now the build works even if I don't delete the contents from previous builds. Not entirely sure why this worked but it did.