Failed to launch openocd gdb server error spawn openocd exe enoent

I am trying to use this extension to debug a LPC4337 board via OpenOCD. However I have no luck yet getting it working. From the same directory using the command line I can start an openOCD session ...

@ijager

I am trying to use this extension to debug a LPC4337 board via OpenOCD. However I have no luck yet getting it working.

From the same directory using the command line I can start an openOCD session and fire up GDB which works fine.

This is my launch.json configuration:

 "configurations": [
        {
            "showDevDebugOutput": true,
            "type": "cortex-debug",
            "request": "attach",
            "servertype": "openocd",
            "cwd": "${workspaceRoot}",
            "executable": "./build/blinky_m4",
            "name": "Cortex Debug",
            "device": "LPC43xx",
            "configFiles": [
                "interface/ftdi/jtag-lock-pick_tiny_2.cfg",
                "./lpc4337_jtag.cfg"
            ],
        }
    ]

VSCode gives me the following error when I try to run the debugger:
Failed to launch OpenOCD GDB Server: Timeout.

And in the developer console I see this output:

[marus25.cortex-debug]Cannot read property 'getTime' of null
e.$onExtensionRuntimeError @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:3227
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:3227 TypeError: Cannot read property 'getTime' of null 
at Object.endSession (../out/src/reporting.js:94:52)
at CortexDebugExtension.debugSessionTerminated (../out/src/frontend/extension.js:299:29)

The extension crashes on this line, reporting.ts:105:

    const time = (endTime.getTime() - sessionStart.getTime()) / 1000;

Since sessionStart is null (Is that a situation that should be possible?). I am not sure what that means, I guess it wasn’t able to successfully start a debugging session?

What I can see is that OpenOCD does start properly (the led on my jtag device starts blinking and OpenOCD is briefly in my process list), but GDB does not appear in my process list.
Am I missing something? I am willing to investigate further but I don’t really know where to start since there is so little feedback/output. Any suggestions are appreciated.

MacOS 10.13.6
VSCode 1.26.1
OpenOCD 0.10
GDB: GNU gdb (GNU Tools for Arm Embedded Processors 7-2018-q2-update) 8.1.0.20180315-git

@chetferry

The cortex-debug extension used to work great for me. I am now on the latest MacOs and am not able to get it working any more. I get a message that says:

Failed to launch undefined GDB Server: Timeout.

MacOS 10.13.6
vscode 1.26.1
Jlink 6.34b
Compiler gcc-arm-none-eabi-7-2018-q2-update

My launch.json file has this:

{
«version»: «0.2.0»,
«configurations»: [

    {
        "type": "cortex-debug",
        "request": "launch",
        "servertype": "jlink",
        "cwd": "${workspaceRoot}",
        "executable": "${workspaceRoot}/build/f767_rtos_test.elf",
        "svdFile": "${workspaceRoot}/STM32F7x7_v1r2.svd",
        "name": "Debug (J-Link)",
        "device": "STM32F767ZI",
        "interface": "swd",
        "ipAddress": null,
        "serialNumber": null
    }
]

}

I know the target and cable are all good. When I use Segger Ozone it all works correctly.

@busticated

i’m hitting this now as well.

after launching into debug mode (green «play» button in the debug view), i see an error notification bottom-right that reads: Debug adapter process has terminated unexpectedly (read ECONNRESET) and my debug session never launches.

when i open dev tools (Help > Toggle Developer Tools), i see this error:

TypeError: Cannot read property 'getTime' of null
	at Object.endSession (./marus25.cortex-debug-0.1.21/out/src/reporting.js:94:52)
	at CortexDebugExtension.debugSessionTerminated (./marus25.cortex-debug-0.1.21/out/src/frontend/extension.js:299:29)
	at e.fire (./node/extensionHostProcess.js:133:218)

the adapter output log:

Open On-Chip Debugger 0.10.0 (2018-12-14-08:23)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.10
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Info : stm32f2x.cpu: hardware has 6 breakpoints, 4 watchpoints

the open-ocd process is left running so trying to re-launch debug mode via the green «play» button yields:

Open On-Chip Debugger 0.10.0 (2018-12-14-08:23)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
cortex_m reset_config sysresetreq
Error: couldn't bind tcl to socket: Address already in use

doing the same thing using the same configuration over on mac (high sierra), everything seems to work fine. i don’t see an error, i’m able to pause at break-points, step-thru, etc.

i’m running:
Ubuntu: 18.04.1 (LTS)
VSCode: 1.30.0
Cortex Debug: 0.1.21

@dylad

I encountered the same issue. Does someone already found a fix ?

@democles9308

Related Issue : can’t even launch openOCD : Error Spawn openocd ENOENT
linux MX 18 — openocd 0.10 — VSCode : 1.30.0 (flatpak) — cortex-debug 0.1.21

launch.json:

«version»: «0.2.0»,
«configurations»: [
{
«cwd»: «${workspaceRoot}»,
«executable»: «/home/democles/Documents/Projects/STMdrone/.pioenvs/genericSTM32F103C8/firmware.elf»,
«name»: «Debug OPENOCD»,
«request»: «launch»,
«type»: «cortex-debug»,
«servertype»: «openocd»,
«device»:»STM32F103C8″,
«configFiles»: [«/usr/local/share/openocd/scripts/interface/stlink-v2.cfg»,»/usr/local/share/openocd/scripts/target/stm32f1x.cfg»],
}

Openocd build from source with ./configure —enable-stlink and intalled in /usr/local/bin:

openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg
Open On-Chip Debugger 0.10.0
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 ‘.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v29 API v2 SWIM v7 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.213613
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints

usr/local/bin is in the $PATH…

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin

even when I put the path in the cortex-debug.openocdPath via the settings, I still got the spawn error..

Any help much apreciated.

@efryters

I have a similar error as @busticated mentioned.
It turns out that 18.04 Ubuntu does not have the GDB executable arm-none-eabi-gdb, so the extention hangs on debug. (https://askubuntu.com/questions/1031103/how-to-install-gdb-arm-none-eabi-on-ubuntu-18-04/1033056)
My workaround was:

  1. Apt install package: gdb-multiarch (Since normal GDB doesn’t support ARM)
  2. Add symbolic link
$ sudo ln -s /usr/bin/gdb-multiarch /usr/bin/arm-none-eabi-gdb

OR edit launch.json to point to the gdb-multiarch

        {
            "name": "Cortex Debug OpenOCD",
            "cwd": "${workspaceRoot}",
            "executable": "./build/aero2_firmware.elf",
            "request": "attach",
            "type": "cortex-debug",
            "servertype": "openocd",
             ........
            "showDevDebugOutput": false,
            "gdbpath": "/usr/bin/gdb-multiarch"
        },
  1. Try to debug again
    And that seemed to work for me but now I’ve got a new issue during debug where when the execution is broken at a breakpoint, I can change my tabs or view to anything else. It immediately snaps back to the line of code where it paused.

@democles9308

Thanks for reply,
FWIW, the arm-none-eabi toolchain is installed when you install cortex-debug,together with other tools (openocd etc) ( have a look in the .platformio/packages directories.
The problem remains to open the openocd… I changed back to mint linux and did a fresh install and on this platform I always get timeouts from the GDB ( when using the cortex-debug plugin). Strange because everything works when I launch the process manually (i.e start openocd from a terminal and start the gdb from another terminal).
So there must be something with the plugin as I’m using the provided tools. As extra I installed eclipse and there everything works also.
Sad… I’d love to use visual studio code with the cortex plugin….

@democles9308

Strange,
To doublecheck with eclipse, I installed the GNU MCU eclipse toolchain and openocd. This works fine in eclipse but by interest I went back to visual code studio with cortex-debug and tried the debugger by using the GNU MCU eclipse toolchain /openocd… and guess what… no timeout to connect error, but a working environment…
One minor thing to solve… Its seems that I have always to reconfiure the launch.json file with my cortex-debug(openocd) setting. Is it rewritten by platformio by the start up ?

@dhinault

To doublecheck with eclipse, I installed the GNU MCU eclipse toolchain and openocd. This works fine in eclipse but by interest I went back to visual code studio with cortex-debug and tried the debugger by using the GNU MCU eclipse toolchain /openocd… and guess what… no timeout to connect error, but a working environment…
One minor thing to solve… Its seems that I have always to reconfiure the launch.json file with my cortex-debug(openocd) setting. Is it rewritten by platformio by the start up ?

have the same error «error Spawn Openocd ENOENT «, How did you solve the problem?

@democles9308

@dhinault,

I installed the GNU MCU eclipse toolchain and Openocd as explained on the site and used these versions in the settings of cortex-debug via file > preferences> settings/Extensions/cortex-debug
For the arm toolchain path I’ve thefollowing:
{ "terminal.integrated.rendererType": "dom", "cortex-debug.openocdPath": "/home/democles/opt/gnu-mcu-eclipse/openocd/0.10.0-10-20181020-0522/bin/openocd", "cortex-debug.enableTelemetry": false, "cortex-debug.stutilPath": "/home/democles/.platformio/packages/tool-stlink/bin/st-util", "cortex-debug.armToolchainPath": "/home/democles/opt/gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.1-20190102-1122/bin", "workbench.iconTheme": "vscode-icons", "workbench.colorTheme": "Solarized Dark", }
my launch.json file looks like:
{ "cwd": "${workspaceRoot}", "executable": "${workspaceRoot}/.pioenvs/genericSTM32F103C8/firmware.elf", "name": "Debug Microcontroller", "request": "launch", "type": "cortex-debug", "servertype": "openocd", "device": "STM32F103C8", "configFiles": ["/home/democles/opt/gnu-mcu-eclipse/openocd/0.10.0-10-20181020-0522/scripts/interface/stlink-v2.cfg","/home/democles/opt/gnu-mcu-eclipse/openocd/0.10.0-10-20181020-0522/scripts/target/stm32f1x.cfg"] }
Hope this helps you

@userFromHades

I’ve got the same error message. But indeed open ocd starts. I can see how led diode blinks on my st-link. I see a process in «ps aux | grep openocd».

At the same time in debug console appears record
Launching server: "/usr/bin/openocd" "-c" "gdb_port 50000" "-s" "/home/user/work/osciloscope/src/firmware" "-f" "openocd.cfg"

If i run openocd manually by command
/usr/bin/openocd -c gdb_port 50000 -s /home/user/work/osciloscope/src/firmware -f openocd.cfg
it is working normally.

Ubuntu 19.04

VS Code

Version: 1.38.1
Commit: b37e54c98e1a74ba89e03073e5a3761284e3ffb0
Date: 2019-09-11T13:30:08.229Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Linux x64 5.0.0-31-generic snap

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "cwd": "${workspaceRoot}",
            "executable": "{workspaceFolder}/../../build/firmware.elf",
            "name": "Debug Microcontroller",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "openocd",
            "svdFile": "STM32F103xx.svd",
            "configFiles": [
                "openocd.cfg"
            ],
            "showDevDebugOutput": true,
            "gdbpath": "/usr/bin/gdb-multiarch"
        }
    ]
}

@haneefdm

If you are seeing a spawn error with ENOENT it means Cortex-Debug could not find the OpenOCD executable. In your user-level settings.json or your workspace level .vscode/settings.json, you will need something like.

"cortex-debug.openocdPath": "/Applications/ModusToolbox_2.0/tools_2.0/openocd/bin/openocd"

But if you are seeing openocd running with ps aux then that is not the same problem. There are multiple (possibly different) errors/issues reported above so I can’t tell which ones you are seeing specifically

If you are starting OpenOCD manually, then the quotes are still important especially if spaces are involved like for the "gdb_port 50000"

@keithpenney

I ran into the same problem using openocd as a CLI. Big caveat — I am using an unofficial binary:

OpenOCD 0.10.0
commit date: 2017-01-22 20:31:28
build date: 2017-01-23
Windows 10 (x64)

Using an STM32F4-Discovery board (STM32F407VGT6) with latest ST-Link firmware V2.J34.M25, I tried openocd -f interface/stlink-v2-1.cfg -f target/stm32f4x.cfg and it hangs just before establishing the GDB/telnet servers. The last info text says,

Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints

Cranking up the debug level to 3 with -d, it looks like it hangs somewhere around the PLD initialization stage (which should be a no-op for this target). The last debug text is,

Debug: 385 6528 pld.c:205 handle_pld_init_command(): Initializing PLDs...

It’s not unresponsive — still catches process kill (Ctrl+C) and cleanly exists with,

Debug: 386 523794 hla_interface.c:117 hl_interface_quit(): hl_interface_quit

An interesting side note, if I don’t actually attempt to start the GDB/telnet server, it will happily run a jimtcl script successfully. E.g.:

openocd -f interface/stlink-v2-1.cfg -f target/stm32f4x.cfg -c "program filename.elf verify reset exit"

works fine.

It’d be great to integrate openocd fully into my toolchain, but I’m just going to switch to ST’s utilities for now. Gotta get the job done.

@haneefdm

All OpenOCD’s are unofficial nowadays. Every vendor is releasing their own version and that is fine. If it works for you manually, then it should work with this extension.

You have to set the configFiles to ["interface/stlink-v2-1.cfg", "target/stm32f4x.cfg"] in launch.json. You may also have to set the search path as well using searchDir Check the debug console for command line used for openocd.

@haneefdm

You don’t need to do -c "program filename.elf verify reset exit" as that is done by this extension via gdb monitor commands. You can customize additional commands using pre/post/override launch/attach/restart options in launch.json

@keithpenney

I’m not using it as a plugin. It’s just part of my CLI toolchain, so no launch.json involved. And I can’t use GBD monitor commands if the server isn’t starting.

@haneefdm

This extension starts the GDB server (openocd).

I have no idea what your flow is. No launch.json means you are not using this extension or even VSCode and your question is meant for someone else. Not for this repo.

This repo is for VSCode + this extension and aimed at debugging ARM 32-bit Cortex devices

@cbj0
cbj0

mentioned this issue

Nov 3, 2021

Содержание

  1. openocd failed to launch — launch.json #281
  2. Comments
  3. Footer
  4. Failed to launch OpenOCD GDB Server: Error: spawn #459
  5. Comments
  6. Footer
  7. Failed to launch openocd gdb server error spawn openocd exe enoent
  8. Failed to launch OpenOCD GDB Server: Timeout. #81
  9. Comments
  10. Failed to launch OpenOCD GDB Server: Error: spawn /usr/local/bin EACCES #650
  11. Comments

openocd failed to launch — launch.json #281

Failed to launch OpenOCD GDB Server: Error: spawn openocd ENOENT

launch.json
<
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
«version»: «0.2.0»,
«configurations»: [
<
«cwd»: «$«,
«executable»: «./build/VSM3-CB.elf»,
«name»: «Debug Microcontroller»,
«request»: «launch»,
«type»: «cortex-debug»,
«servertype»: «openocd»,
«configFiles»: [«./openocd/openocd.cfg»],
>,
<
«name»: «(gdb) Launch»,
«type»: «cppdbg»,
«request»: «launch»,
«program»: «$/build/VSM3-CB.elf»,
«args»: [],
«stopAtEntry»: false,
«cwd»: «$«,
«environment»: [],
«externalConsole»: false,
«MIMode»: «gdb»,
«setupCommands»: [
<
«description»: «Enable pretty-printing for gdb»,
«text»: «-enable-pretty-printing»,
«ignoreFailures»: true
>
]
>,
]
>

The text was updated successfully, but these errors were encountered:

Added path using serverpath

It works now, thanks.

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Failed to launch OpenOCD GDB Server: Error: spawn #459

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: #281 (comment)
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.

The error output running normal windows is as follows:

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.

Here is my launch.json settings:

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

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

Thank you in advance for any feedback.

The text was updated successfully, but these errors were encountered:

Hmm, this is a head-scratcher. You don’t happen to have a user name that has special characters? If you have anything but 7-bit printable ascii, then it might be a problem

But you say we also have a problem with gdb. The gdb we run is arm-none-eabi-gdb and not plain gdb There are sometimes two bin directories in the compiler distribution. Make sure you are using the right directory for the armToolchainPath

Hmm, this is a head-scratcher. You don’t happen to have a user name that has special characters? If you have anything but 7-bit printable ascii, then it might be a problem

The user name is standard ASCII characters; no special characters.

But you say we also have a problem with gdb. The gdb we run is arm-none-eabi-gdb and not plain gdb There are sometimes two bin directories in the compiler distribution. Make sure you are using the right directory for the armToolchainPath

Correct, I am running the armToolChain gdb. For completeness, I have pasted my path settings.

can you do a dir on those to directories and paste the output? I don’t think it is a security issue because the message says ENOENT meaning file does not exist. Or else it would have said EPERM .

We don’t do anything special. All we do is spawn (NodeJS API) and looks like it is failing.

can you do a dir on those to directories and paste the output? I don’t think it is a security issue because the message says ENOENT meaning file does not exist. Or else it would have said EPERM .

As an experiment, I cloned the cortex-debug repo so I could try to gather more debug information. I am having a compilation issue since I am unable to install webpack. I get a dependency error but, I am not familiar with Node.js. Is the dependency error easy to address? Does the attach log file mean anything useful? eresolve-report.txt

We don’t do anything special. All we do is spawn (NodeJS API) and looks like it is failing.

Could it be I have an incorrect version of NodeJS? I was running NodeJS version 14.6.1. As a test, I uninstalled NodeJS and tried running the debugger again. As expected, I get the same error «Failed to Launch. «.

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.

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.

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Failed to launch openocd gdb server error spawn openocd exe enoent

I have run through the getting started guide from a fress OS install 3 times and cannot get picoprobe to work from vcs.

From the command line I can start openocd, all good. Use GDB to load a file and see output using minicomm.

However, I cannot get VCS to work when I run debug from the IDE.
I have tried everything I know, I did have a DAB INIT failure but I changed privs on my usb port and sorted that now it says

Failed to launch OpenOCD GDB Server:Error spawn /home/pi/pico/openocd/openocd ENOENT

and debug console says

Please check OUTPUT tab (Adapter Output) for output from /home/pi/pico/openocd/openocd
Launching server: «/home/pi/pico/openocd/openocd» «-c» «gdb_port 50000» «-c» «tcl_port 50001» «-c» «telnet_port 50002» «-s» «/home/pi/pico/pico-examples» «-f» «interface/picoprobe.cfg» «-f» «target/rp2040.cfg»

please can you help me?

My setup:
Active Kit: GCC 7.3.1 arm-none-eabi

vsc version : 1.59.0
379476f0e13988d90fab105c5c19e7abc8b1dea8
arm

Program to test hello_usb from pico examples (installed at /home/pico)

Linux: Linux raspberrypi 5.10.52-v7l+ #1441 SMP Tue Aug 3 18:11:56 BST 2021 armv7l GNU/Linux
all repositories installed in /home/pi/pico

Environment variables set in .bashrc:
PICO_EXTRAS_PATH=/home/pi/pico/pico-extras
PICO_SDK_PATH=/home/pi/pico/pico-sdk
PICO_PLAYGROUND_PATH=/home/pi/pico/pico-playground
PICO_EXAMPLES_PATH=/home/pi/pico/pico-examples

openocd version:
Open On-Chip Debugger 0.10.0+dev-g18b4c35-dirty (2021-08-07-18:00)

Источник

Failed to launch OpenOCD GDB Server: Timeout. #81

I am trying to use this extension to debug a LPC4337 board via OpenOCD. However I have no luck yet getting it working.

From the same directory using the command line I can start an openOCD session and fire up GDB which works fine.

This is my launch.json configuration:

VSCode gives me the following error when I try to run the debugger:
Failed to launch OpenOCD GDB Server: Timeout.

And in the developer console I see this output:

The extension crashes on this line, reporting.ts:105:

Since sessionStart is null (Is that a situation that should be possible?). I am not sure what that means, I guess it wasn’t able to successfully start a debugging session?

What I can see is that OpenOCD does start properly (the led on my jtag device starts blinking and OpenOCD is briefly in my process list), but GDB does not appear in my process list.
Am I missing something? I am willing to investigate further but I don’t really know where to start since there is so little feedback/output. Any suggestions are appreciated.

MacOS 10.13.6
VSCode 1.26.1
OpenOCD 0.10
GDB: GNU gdb (GNU Tools for Arm Embedded Processors 7-2018-q2-update) 8.1.0.20180315-git

The text was updated successfully, but these errors were encountered:

The cortex-debug extension used to work great for me. I am now on the latest MacOs and am not able to get it working any more. I get a message that says:

Failed to launch undefined GDB Server: Timeout.

MacOS 10.13.6
vscode 1.26.1
Jlink 6.34b
Compiler gcc-arm-none-eabi-7-2018-q2-update

My launch.json file has this:

I know the target and cable are all good. When I use Segger Ozone it all works correctly.

i’m hitting this now as well.

after launching into debug mode (green «play» button in the debug view), i see an error notification bottom-right that reads: Debug adapter process has terminated unexpectedly (read ECONNRESET) and my debug session never launches.

when i open dev tools (Help > Toggle Developer Tools), i see this error:

the adapter output log:

the open-ocd process is left running so trying to re-launch debug mode via the green «play» button yields:

doing the same thing using the same configuration over on mac (high sierra), everything seems to work fine. i don’t see an error, i’m able to pause at break-points, step-thru, etc.

i’m running:
Ubuntu: 18.04.1 (LTS)
VSCode: 1.30.0
Cortex Debug: 0.1.21

I encountered the same issue. Does someone already found a fix ?

Related Issue : can’t even launch openOCD : Error Spawn openocd ENOENT
linux MX 18 — openocd 0.10 — VSCode : 1.30.0 (flatpak) — cortex-debug 0.1.21

«version»: «0.2.0»,
«configurations»: [
<
«cwd»: «$«,
«executable»: «/home/democles/Documents/Projects/STMdrone/.pioenvs/genericSTM32F103C8/firmware.elf»,
«name»: «Debug OPENOCD»,
«request»: «launch»,
«type»: «cortex-debug»,
«servertype»: «openocd»,
«device»:»STM32F103C8″,
«configFiles»: [«/usr/local/share/openocd/scripts/interface/stlink-v2.cfg»,»/usr/local/share/openocd/scripts/target/stm32f1x.cfg»],
>

Openocd build from source with ./configure —enable-stlink and intalled in /usr/local/bin:

openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg
Open On-Chip Debugger 0.10.0
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 ‘.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v29 API v2 SWIM v7 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.213613
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints

usr/local/bin is in the $PATH.

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin

Источник

Failed to launch OpenOCD GDB Server: Error: spawn /usr/local/bin EACCES #650

1. Environment:

  1. Raspberry Pi 4 up-to-date Raspberry Pi OS with development essentials package installed.
  2. installed Raspberry Pi Pico SDK for C/C++
  3. installed Raspberry Pi version of OpenOCD
  4. installed Raspberry Pi Picoprobe.
  5. Pi 4 connected via USB to Pico with Picoprobe software loaded.
  6. Picoprobe connected to target Raspberry Pi Pico via SWD interface
  7. Target Application compiled on Pi4 using GCC 8.3.1 arm-none-eabi using VScode IDE 1.66.2
  8. VScode click on «Run and Debug» icon.
  9. Click on Pico Debug to start up and debug the application.
  10. Summary: Compiled and ran debugger many times up until mid April developing myproject. I am fairly new at using vscode so I’ve worked to isolate the problem to VScode as the following shows. I can run each of the individual steps ( gdb-multiarch and openocd ) so the components work fine manually using the (displayed) parameters that VScode used according to the DEBUG CONSOLE.

2.The following shows the suspected error output:

VSCode Debug Console Output:

Reading symbols from objdump-multiarch —syms -C -h -w /home/myself/projects/myproject/build/pico-sdk/src/rp2_common/boot_stage2/bs2_default.elf
Reading symbols from nm-multiarch —defined-only -S -l -C -p /home/myself/projects/myproject/build/pico-sdk/src/rp2_common/boot_stage2/bs2_default.elf
Launching GDB: gdb-multiarch -q —interpreter=mi2 /home/myself/projects/myproject/build/pico-sdk/src/rp2_common/boot_stage2/bs2_default.elf
1-gdb-set target-async on
Launching gdb-server: /usr/local/bin -c «gdb_port 50000» -c «tcl_port 50001» -c «telnet_port 50002» -s

/pico/openocd/tcl -f /home/myself/.vscode/extensions/marus25.cortex-debug-1.4.4/support/openocd-helpers.tcl -f interface/picoprobe.cfg -f target/rp2040.cfg
Please check TERMINAL tab (gdb-server) for output from /usr/local/bin
Finished reading symbols from objdump: Time: 257 ms
Finished reading symbols from nm: Time: 238 ms
Failed to launch OpenOCD GDB Server: Error: spawn /usr/local/bin EACCES
———————————————————-End ————————————-

VSCode Terminal Output::

[2022-05-10T23:58:00.145Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to «DEBUG CONSOLE» to see GDB interactions.
/usr/local/bin -c «gdb_port 50000» -c «tcl_port 50001» -c «telnet_port 50002» -s

/pico/openocd/tcl -f /home/myself/.vscode/extensions/marus25.cortex-debug-1.4.4/support/openocd-helpers.tcl -f interface/picoprobe.cfg -f target/rp2040.cfg
[2022-05-10T23:58:01.216Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start.
—————————————————-End ——————————————-

<
«version»: «0.2.0»,
«configurations»: [
<
«name»: «Pico Debug»,
«cwd»: «$«,
«executable»: «$«,
«request»: «launch»,
«type»: «cortex-debug»,
«servertype»: «openocd»,
// This may need to be arm-none-eabi-gdb depending on your system
«gdbPath» : «gdb-multiarch», // was arm-none-eabi-gdb
«device»: «RP2040»,
«configFiles»: [
«interface/picoprobe.cfg»,
«target/rp2040.cfg»
],
«svdFile»: «$/src/rp2040/hardware_regs/rp2040.svd»,
«runToMain»: true,
// Work around for stopping at main on restart
«postRestartCommands»: [
«break main»,
«continue»
],
«searchDir»: [«

<
// These settings tweaks to the cmake plugin will ensure
// that you debug using cortex-debug instead of trying to launch
// a Pico binary on the host
«cmake.statusbar.advanced»: <
«debug»: <
«visibility»: «hidden»
>,
«launch»: <
«visibility»: «hidden»
>,
«build»: <
«visibility»: «default»
>,
«buildTarget»: <
«visibility»: «hidden»
>
>,
«cmake.buildBeforeRun»: true,
«C_Cpp.default.configurationProvider»: «ms-vscode.cmake-tools»,
«cortex-debug.openocdPath»: «/usr/local/bin»,
«code-runner.commands»: <
«cmake-gui»: «cmake-gui $/build»
>,
«cmake.launchTargetPath»: «$/build»
>
—————————————————-End ——————————————-

3. Manul runs of openOCD and gdb:

openocd running at myself@mycomputer:

/usr/local/bin/openocd -c «gdb_port 50000» -c «tcl_port 50001» -c «telnet_port 50002» -s

/pico/openocd/tcl -f /home/myself/.vscode/extensions/marus25.cortex-debug-1.4.4/support/openocd-helpers.tcl -f interface/picoprobe.cfg -f target/rp2040.cfg
Open On-Chip Debugger 0.11.0-g610f137-dirty (2022-05-06-12:52)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
Info : only one transport option; autoselect ‘swd’
adapter speed: 5000 kHz

Info : Hardware thread awareness created
Info : Hardware thread awareness created
Info : RP2040 Flash Bank Command
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : clock speed 5000 kHz
Info : SWD DPIDR 0x0bc12477
Info : SWD DLPIDR 0x00000001
Info : SWD DPIDR 0x0bc12477
Info : SWD DLPIDR 0x10000001
Info : rp2040.core0: hardware has 4 breakpoints, 2 watchpoints
Info : rp2040.core1: hardware has 4 breakpoints, 2 watchpoints
Error: rp2040.core0 — clearing lockup after double fault
Info : starting gdb server for rp2040.core0 on 50000
Info : Listening on port 50000 for gdb connections
—————————————————-End ——————————————-

gdb running at myself@mycomputer:

gdb-multiarch -q —interpreter=mi2 /home/myself/projects/myproject/build/pico-sdk/src/rp2_common/boot_stage2/bs2_default.elf
=thread-group-added,id=»i1″

«Reading symbols from /home/myself/projects/myproject/build/pico-sdk/src/rp2_common/boot_stage2/bs2_default.elf. n»
(gdb)
help
&»helpn»

«List of classes of commands:nn»

«aliases — User-defined aliases of other commands.n»

«breakpoints — Making program stop at certain points.n»

«data — Examining data.n»

«files — Specifying and examining files.n»

«internals — Maintenance commands.n»

«obscure — Obscure features.n»

«running — Running the program.n»

«stack — Examining the stack.n»

«status — Status inquiries.n»

«support — Support facilities.n»

«text-user-interface — TUI is the GDB text based interface.n»

«tracepoints — Tracing of program execution without stopping the program.n»

«user-defined — User-defined commands.n»

«» followed by a class name for a list of commands in that class.nType «help all» for the list of all commands.»

«» followed by command name for full documentation.n»

«Type «apropos word» to search for commands related to «word».n»

«Type «apropos -v word» for full documentation of commands related to «word».n»

Version: 1.66.2
Commit: dfd34e8260c270da74b5c2d86d61aee4b6d56977
Date: 2022-04-11T07:45:25.488Z
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Linux arm 5.15.32-v7l+

ls -al on /usr/local/bin :

total 14708
drwxr-xr-x 2 root root 4096 May 11 23:25 .
drwxr-xr-x 10 root root 4096 Apr 4 04:45 ..
-rwxr-xr-x 1 root root 15050860 May 11 23:25 openocd

System Info

Item Value
CPUs ARMv7 Processor rev 3 (v7l) (4 x 1500)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 1, 1, 0
Memory (System) 3.75GB (0.73GB free)
Process Argv —unity-launch —crash-reporter-id 287cf0da-90f5-4a95-b743-33ad58f1cc3e
Screen Reader no
VM 0%
DESKTOP_SESSION LXDE-pi
XDG_CURRENT_DESKTOP LXDE
XDG_SESSION_DESKTOP lightdm-xsession
XDG_SESSION_TYPE x11

Extensions (9)

Extension Author (truncated) Version
better-comments aar 3.0.0
doxdocgen csc 1.4.0
code-runner for 0.11.7
better-cpp-syntax jef 1.15.13
cortex-debug mar 1.4.4
cmake-tools ms- 1.10.5
cpptools ms- 1.9.8
cpptools-extension-pack ms- 1.2.0
cmake twx 0.0.17

(1 theme extensions excluded)

The text was updated successfully, but these errors were encountered:

Источник

parrst

Posts: 49
Joined: Sun May 22, 2022 5:16 pm

Can’t get debug to work on VS Code

I got openocd, picotool and a working pico with picoprobe. I have tested openocd and picotool from comand line and they seem to work. But when I try to debug from VS code it builds without error then I get a popup that says «OpenOCD: GDB Server Quit Unexpectedly. See gdb-server output in TERMINAL tab for more details»

Terminal only has:

Code: Select all

[2023-01-20T01:03:54.661Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
openocd.exe -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "D:\Pico\pico-examples\blink" -f "c:/Users/Bob/.vscode/extensions/marus25.cortex-debug-1.6.10/support/openocd-helpers.tcl" -f interface/raspberrypi-swd.cfg -f target/rp2040.cfg
Open On-Chip Debugger 0.10.0+dev-g14c0d0d-dirty (2021-01-27-15:43)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
[2023-01-20T01:03:55.492Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...

Not sure where to go from here.

Bob


User avatar

penitko

Posts: 84
Joined: Thu Jun 10, 2021 9:25 am
Location: Finland, Vantaa

Re: Can’t get debug to work on VS Code

Fri Jan 20, 2023 1:52 am

Have you followed Shawn Hymel’s instructions to build pico debugging envinronment to the Windows?
Shawn’s video and web page is found from here:
https://www.digikey.be/en/maker/project … 6f67f184c0
Raspberry Pi Pico and RP2040 — C/C++ Part 2: Debugging with VS Code

You should consider to use this command when compiling openocd in Windows too:
./configure —enable-picoprobe —disable-werror


parrst

Posts: 49
Joined: Sun May 22, 2022 5:16 pm

Re: Can’t get debug to work on VS Code

Fri Jan 20, 2023 4:57 am

penitko wrote: ↑

Fri Jan 20, 2023 1:52 am


Have you followed Shawn Hymel’s instructions to build pico debugging envinronment to the Windows?

You should consider to use this command when compiling openocd in Windows too:
./configure —enable-picoprobe —disable-werror

Yes… at least this version is what I followed…

https://shawnhymel.com/2168/how-to-buil … n-windows/

Followed the following steps:

Code: Select all

cd /c/VSARM/sdk/pico
git clone -b master https://github.com/raspberrypi/picotool.git 
cd picotool
mkdir build
cd build
cmake -G "MinGW Makefiles" -DPC_LIBUSB_INCLUDEDIR="/c/git-sdk-64/mingw64/include/libusb-1.0" ..
make

and at make all I got was…

Code: Select all

make
make[2]: Entering directory '/d/Pico/picotool/build'
Microsoft Windows [Version 10.0.22621.1105]
(c) Microsoft Corporation. All rights reserved.

D:Picopicotoolbuild>

Which finished in less than a second. The [2] is because it is the third time I tried the make command. when I try to close SDK-64 I get a message about processes are running and make is one of them… well three now. I did end up getting a picotools from somewhere and tested it. I just can’t get VS Code to debug, or tell me what is wrong.

Bob


parrst

Posts: 49
Joined: Sun May 22, 2022 5:16 pm

Re: Can’t get debug to work on VS Code

Fri Jan 20, 2023 5:03 am

penitko wrote: ↑

Fri Jan 20, 2023 1:52 am


You should consider to use this command when compiling openocd in Windows too:
./configure —enable-picoprobe —disable-werror

I did

Bob


parrst

Posts: 49
Joined: Sun May 22, 2022 5:16 pm

Re: Can’t get debug to work on VS Code

Fri Jan 20, 2023 7:08 am

Not sure what I did, but now I get an error when I try to debug…

Failed to launch OpenOCD GDB Server: Error: spawn D:Picoopenocdsrc ENOENT

That is where openocd.exe and the libusb-1.0.dll are.


jamesh

Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 32176
Joined: Sat Jul 30, 2011 7:41 pm

Re: Can’t get debug to work on VS Code

Fri Jan 20, 2023 8:38 am

We’ve been working on improving Windows debugging, I’ll see what is ready to be released. I had a very similar issue which is now working, but not sure of the exact fix needed.

Principal Software Engineer at Raspberry Pi Ltd.
Working in the Applications Team.


parrst

Posts: 49
Joined: Sun May 22, 2022 5:16 pm

Re: Can’t get debug to work on VS Code

Fri Jan 20, 2023 2:31 pm

Not sure what the problem was, but I deleted build and .vscode and rebuilt it and it seems to be working. Threw a couple compile errors on some SDK code, but still ran… Was only the blink example so not a whole lot to it.

If there are some updates, let me know, but for now I think I got it. Will try on another program today or tomorrow.

Thanks,
Bob


Return to “General”

Понравилась статья? Поделить с друзьями:
  • Failed to load dx9 dlls как исправить
  • Failed to load driver reason unknown error 19
  • Failed to load dll from the list error code 998 как исправить
  • Failed to load dll from the list error code 998 satisfactory как решить
  • Failed to launch gdb error erasing flash with vflasherase packet from target download