question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to launch OpenOCD GDB Server: Error: spawn

See original GitHub issue

I have search through the issues and I am still unable to get OpenOCD to work with VS Code and cortex-debug. My issue is identical to: https://github.com/Marus/cortex-debug/issues/281#issue-607868097 Unfortunately, updating my system path to include OpenOCD did not correct my problem. I have tried several versions of OpenOCD and I get the same issue. As a hail mary, I attempted to run the debugger in safe mode. This provided interesting error output. cortex_error

The error output running normal windows is as follows: image

Both applications, openocd.exe and arm-none-eabi-gdb.exe can be launched from the command window without issue. The utilities are accessible in the designated files.

The following versions of Windows, VS Code, and Cortex-Debug are being used. image

Here is my launch.json settings:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "cwd": "D:/target",
            "executable": "${workspaceFolder}/target/thumbv7em-none-eabi/debug/target.elf",
            "request": "launch",
            "type": "cortex-debug",
            //"servertype": "external",
            //"gdbTarget": "localhost:50000",
            "servertype": "openocd",
            "searchDir": [
                "D:/boards/target/jtag"
            ],
            "configFiles": [
                "config.cfg",
                "chip.cfg",
                "board.cfg"
            ],
            "runToMain": false,
            "preRestartCommands": [
                "monitor reset",
                "file D:/target/thumbv7em-none-eabi/debug/target.elf",
                "load",
                "target extended-remote :50000",
                "monitor reset halt"
            ]
        }
    ]
}

Note, I tried setting the severtype to external and I get the same ENOENT error for the armToolchainPath.
Here is my settings.json:

{
    "editor.formatOnSave": true,
    "cortex-debug.openocdPath": "C:/Users/<user>/AppData/Roaming/xPacks/xpack-openocd-0.11.0-1/bin/openocd.exe",
    //"cortex-debug.openocdPath": "C:/Temp/xpack-openocd-0.11.0-1/bin/openocd.exe",
    //"cortex-debug.openocdPath": "openocd.exe",
    "cortex-debug.armToolchainPath": "C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2020-q4-major/bin",
}

What else can I try to get the cortex debugger to work?

Thank you in advance for any feedback.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

5reactions
jrhugcommented, Aug 10, 2021

Update: Long story short, I built a new system and loaded a fresh copy of Windows 7. At first, I had the same issue. After playing around a bit, I finally got the extension working. Will provide further details in the future. Closing this issue now.

0reactions
haneefdmcommented, Aug 6, 2021

I doubt NodeJS is wrong. I am using 14.6.0 and I am getting the same problem if I change package.json to upgrade to latest webpack. It still compiles though.

After cloning the report, just run ‘npm install’, do not install/upgrade any modules. There are too many dependencies and if you change one thing, it leads to another. I will clean it up when I have some time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: spawn openocd.exe ENOENT" I was wondering ... - Reddit
I got an error in Vscode when I want to debug "Failed to launch OpenOCD GDB Server: Error: spawn openocd.exe ENOENT" I was...
Read more >
Problem with Visual Studio Code debugging - Onethinx Forum
I wanted upload VStest code from youtube tutorial but I have error: Faild to launch OpenOCD GDB Server: Error: spawn
Read more >
Under VSCode Pressing Pico Debug results in "Failed to ...
Under VSCode Pressing Pico Debug results in "Failed to launch OpenOCD GDB Server: Timeout." I also see the debug bar immediately when pressing ......
Read more >
Problem understanding cortex-debug configurations in Visual ...
My GDB server would be OpenOCD and my client is the arm-none-eabi-gdb utility if I get this right from the debug console. I...
Read more >
[ISSUE] Failed to launch OpenOCD GDB Server: Timeout
After the device is put into DFU mode and flashed, it says that the flash was successful, and immediately that error pops up....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found