Picoprobe on Windows: GDBServerConsole: onBackendConnect: gdb-server program client error Error: read ECONNRESET
Michel-0 opened this issue · 6 comments
TLDR: Current problem see last post at the bottom.
#70 (comment)
Hi there,
I'm having a hard time getting my environment set up to debug a Pico on Windows 11.
In general I tried to follow the guideline getting-started-with-pico
as close as possible.
Now I'm at a point where I:
- Installed the
ARM GNU Toolchain
- Installed
CMake
- Installed
Build Tools for Visual Studio
(Visual Studio already has been installed) - Installed
Python
Git
already has been installed- Installed
Visual Studio Code
(after i gave up getting Visual Studio up running) - Installed extensions
C/C++
,CMake
,CMake Tools
,Cortex-Debug
forVisual Studio Code
- Cloned the
pico-sdk
repo and its submodules - Cloned the
pico-examples
repo - Set up
Visual Studio Code
like described ingetting-started-with-pico
and also added all necessary stuff to myPATH
environment variable
Then i was able to successfully compile all pico-examples
from within Visual Studio code
!
But i want to be able to do online-debugging so i did the next steps like described in getting-started-with-pico
:
- Installed
MSys2
- Set up
MSys2
and its packages like described ingetting-started-with-pico
- Installed
libusb-win32
picoprobe driver usingZadig
like described ingetting-started-with-pico
- Cloned
openocd
rp2040 branch - Tried to build it, failed because libusb was missing
- Tried couple of things, but in the end it only worked after I: cloned
libusb
repo - Build
libusb
and added it toPATH
- Tried again to build
openocd
, succeeded and added it toPATH
- Added
GDB
fromMSys2
toPATH
- Set up
Visual Studio Code
like described ingetting-started-with-pico
(launch.json
&settings.json
)
Now finally the actual problem:
When starting debugging Pico Debug
on project blink
of pico-examples
this error occurs.
Debugging console output:
Cortex-Debug: VSCode debugger extension version 1.6.3 git(6285985). Usage info: https://github.com/Marus/cortex-debug#usage
Reading symbols from arm-none-eabi-objdump --syms -C -h -w D:/Projects/pico/pico-examples/build/blink/blink.elf
Reading symbols from arm-none-eabi-nm --defined-only -S -l -C -p D:/Projects/pico/pico-examples/build/blink/blink.elf
Launching GDB: arm-none-eabi-gdb -q --interpreter=mi2
IMPORTANT: Set "showDevDebugOutput": "raw" in "launch.json" to see verbose GDB transactions here. Very helpful to debug issues or report problems
Launching gdb-server: openocd.exe -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "D:\\Projects\\pico\\pico-examples" -f "c:/Users/***/.vscode/extensions/marus25.cortex-debug-1.6.3/support/openocd-helpers.tcl" -f interface/raspberrypi-swd.cfg -f target/rp2040.cfg
Please check TERMINAL tab (gdb-server) for output from openocd.exe
Finished reading symbols from objdump: Time: 1939 ms
Finished reading symbols from nm: Time: 1868 ms
Error: Unable to start GDB even after 5 seconds or it couldn't even start Make sure you can start gdb from the command-line and run any command like "echo hello".
If you cannot, it is most likely because "libncurses5" or "python" is not installed. Some GDBs require these
Finished reading symbols from nm: Time: 473 ms
GDB could not start as expected. Bad installation or version mismatch. See if you can start gdb from a shell prompt and check its version (Must be >= 9)
Terminal output:
Waiting for gdb server to start...[2022-09-09T10:58:15.558Z] 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:\\Projects\\pico\\pico-examples" -f "c:/Users/***/.vscode/extensions/marus25.cortex-debug-1.6.3/support/openocd-helpers.tcl" -f interface/raspberrypi-swd.cfg -f target/rp2040.cfg
[2022-09-09T10:58:15.782Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
Previous CMake/Build output:
[variant] Loaded new set of variants
[kit] Successfully loaded 5 kits from C:\Users\***\AppData\Local\CMakeTools\cmake-tools-kits.json
[proc] Executing command: "C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\11.2 2022.02\bin\arm-none-eabi-gcc.exe" -v
[main] Configuring folder: pico-examples
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\11.2 2022.02\bin\arm-none-eabi-gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\11.2 2022.02\bin\arm-none-eabi-g++.exe" -Sd:/Projects/pico/pico-examples -Bd:/Projects/pico/pico-examples/build -G "NMake Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] PICO_SDK_PATH is D:/Projects/pico/pico-sdk
[cmake] PICO platform is rp2040.
[cmake] Build type is Debug
[cmake] Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize)
[cmake] PICO target board is pico.
[cmake] Using board configuration from D:/Projects/pico/pico-sdk/src/boards/include/boards/pico.h
[cmake] TinyUSB available at D:/Projects/pico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; enabling build support for USB.
[cmake] Compiling TinyUSB with CFG_TUSB_DEBUG=1
[cmake] cyw43-driver available at D:/Projects/pico/pico-sdk/lib/cyw43-driver
[cmake] lwIP available at D:/Projects/pico/pico-sdk/lib/lwip
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: D:/Projects/pico/pico-examples/build
[main] Building folder: pico-examples blink
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build d:/Projects/pico/pico-examples/build --config Debug --target blink -j 14 --
[build] Warning: NMake does not support parallel builds. Ignoring parallel build command line option.
[build] Scanning dependencies of target bs2_default
[build] [ 0%] Built target bs2_default
[build] [ 0%] Built target bs2_default_padded_checksummed_asm
[build] [ 0%] Performing build step for 'ELF2UF2Build'
[build]
[build] Microsoft (R) Program Maintenance Utility, Version 14.29.30146.0
[build] Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
[build]
[build] [100%] Built target elf2uf2
[build] [ 0%] No install step for 'ELF2UF2Build'
[build] [ 0%] Completed 'ELF2UF2Build'
[build] [ 0%] Built target ELF2UF2Build
[build] Scanning dependencies of target blink
[build] Consolidate compiler generated dependencies of target blink
[build] [100%] Built target blink
[build] Build finished with exit code 0
I'm kind of clueless right now, also can't find any useful information regarding this specific error on the web.
So any help would be welcome.
After lot's of struggeling I almost think I'm the only person who tries to DEBUG an Pico on Windows... also I would have some feedback to the getting-started-with-pico
guideline, where would be the correct place to share it?
Ah yes and I almost forget...
Of course I did wire up 2 Picos like described in Appendix A Using Picoprobe
in the getting-started-with-pico
guide and flashed the Picoprobe Pico with the Picoprobe UF2.
The electrical work was the easy part... honestly I would never expect setting up a debugging workspace to be complicated like this - and I worked with ARM microcontrollers before.
Kind regards,
Michel-0
Update 1:
I did what the console told me.
IMPORTANT: Set "showDevDebugOutput": "raw" in "launch.json" to see verbose GDB transactions here.
Now the therminal output looks like this:
[2022-09-09T12:39:07.939Z] 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:\\Projects\\pico\\pico-examples" -f "c:/Users/***/.vscode/extensions/marus25.cortex-debug-1.6.3/support/openocd-helpers.tcl" -f interface/raspberrypi-swd.cfg -f target/rp2040.cfg
Open On-Chip Debugger 0.11.0-g228ede4 (2022-09-09-01:28)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
embedded:startup.tcl:26: Error: Can't find interface/raspberrypi-swd.cfg
in procedure 'script'
at file "embedded:startup.tcl", line 26
[2022-09-09T12:39:07.992Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
embedded:startup.tcl:26: Error: Can't find interface/raspberrypi-swd.cfg in procedure 'script' at file "embedded:startup.tcl", line 26
Hmmm.... I've got a raspberrypi-swd.cfg
at D:\Projects\pico\openocd\tcl\interface
... how may I tell GDP (or openocd?) that?
Update 2:
I changed the configFiles
in the launch.json
from
"configFiles": [
"interface/raspberrypi-swd.cfg",
"target/rp2040.cfg"
],
to
"configFiles": [
"D:\\Projects\\pico\\openocd\\tcl\\interface\\raspberrypi-swd.cfg",
"D:\\Projects\\pico\\openocd\\tcl\\target\\rp2040.cfg"
],
Altough this feels like something wrong to do since this file is from pico-examples
GIT, it seems like I'm one step further now.
Now I'm getting this error:
[2022-09-09T13:12:22.913Z] 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:\\Projects\\pico\\pico-examples" -f "c:/Users/***/.vscode/extensions/marus25.cortex-debug-1.6.3/support/openocd-helpers.tcl" -f "D:\\Projects\\pico\\openocd\\tcl\\interface\\raspberrypi-swd.cfg" -f "D:\\Projects\\pico\\openocd\\tcl\\target\\rp2040.cfg"
Open On-Chip Debugger 0.11.0-g228ede4 (2022-09-09-01:28)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
Error: The specified debug interface was not found (bcm2835gpio)
The following debug adapters are available:
1: ftdi
2: usb_blaster
3: ft232r
4: jlink
5: vsllink
6: ulink
7: hla
8: osbdm
9: opendous
10: aice
11: picoprobe
12: cmsis-dap
13: xds110
14: st-link
[2022-09-09T13:12:22.956Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
Trying to delete openocd
, clone it again and configure with parameter --enable-bcm2835gpio
, altough getting-started-with-pico
doesn't say anything about that parameter...
After lot's of struggeling I almost think I'm the only person who tries to DEBUG an Pico on Windows
I can assure you that we did lots of testing of the instructions in the documentation, including the debugging steps, on Windows, Mac and Linux, before the release of the RP2040. But it's possible that some of the external software in the instructions has changed in the meantime, and we've not had time to revisit the instructions and update them as necessary.
EDIT: A colleague also tells me that he tested the instructions on Windows 11 prior to the release of Pico W.
also I would have some feedback to the getting-started-with-pico guideline, where would be the correct place to share it?
At https://github.com/raspberrypi/pico-feedback please.
"interface/raspberrypi-swd.cfg"
That's only for if you're debugging a Pico using the GPIO pins on a Raspberry Pi (e.g. like in Chapter 5 of the Getting-Started guide), and this is also why you're getting an error about bcm2835gpio. If you're using one Pico to debug another Pico, then I suspect you need to use interface/picoprobe.cfg
instead, as shown on page 64 of the same PDF.
In general, for these types of installation questions, you're likely to get more help by asking at https://forums.raspberrypi.com/viewforum.php?f=143
Trying to delete openocd, clone it again and configure with parameter --enable-bcm2835gpio, altough getting-started-with-pico doesn't say anything about that parameter...
Failed. Hung up at the libusb is required
error again I solved yesterday somehow while building openocd.
If you're using one Pico to debug another Pico, then I suspect you need to use interface/picoprobe.cfg instead
Okay, makes sense somehow. Backuped my yesterday built openocd, changed the referenced CFG, now i got:
[2022-09-09T15:03:02.162Z] 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:\\Projects\\pico\\pico-examples" -f "c:/Users/***/.vscode/extensions/marus25.cortex-debug-1.6.3/support/openocd-helpers.tcl" -f "D:\\Projects\\pico\\openocd\\tcl\\interface\\picoprobe.cfg" -f "D:\\Projects\\pico\\openocd\\tcl\\target\\rp2040.cfg"
Open On-Chip Debugger 0.11.0-g228ede4 (2022-09-09-01:28)
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
D:\Projects\pico\openocd\tcl\target\rp2040.cfg:1: Error: Can't find target/swj-dp.tcl
in procedure 'script'
at file "embedded:startup.tcl", line 26
at file "D:\Projects\pico\openocd\tcl\target\rp2040.cfg", line 1
[2022-09-09T15:03:02.219Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
All those relative paths are misleading, what am I missing?
There is a D:\Projects\pico\openocd\tcl\target\swj-dp.tcl
, why doesn't it find it?
At https://github.com/raspberrypi/pico-feedback please.
All right, thanks, I will post something there once I've got it running maybe someday...
In general, for these types of installation questions, you're likely to get more help by asking at https://forums.raspberrypi.com/viewforum.php?f=143
I already assumed so, but I've got no forums account (yet), so I thought I'll try here first.
btw...
as shown on page 64 of the same PDF
That's the description of terminal usage, isn't it? I didn't realize it must be changed for Visual Studio Code debugging usage, too.
EDIT:
If I turn back the launch.json
"configFiles"
to relative paths instead of absolute full paths it also cannot find the interface/picoprobe.cfg
in the first place.
Update:
Found https://forums.raspberrypi.com/viewtopic.php?t=301122.
Added "searchDir": [ "D:\\Projects\\pico\\openocd\\tcl" ]
to the launch.json
.
Seems like one step forward. Now I get:
[2022-09-09T15:28:28.194Z] 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:\\Projects\\pico\\openocd\\tcl" -f "c:/Users/***/.vscode/extensions/marus25.cortex-debug-1.6.3/support/openocd-helpers.tcl" -f interface/picoprobe.cfg -f target/rp2040.cfg
Open On-Chip Debugger 0.11.0-g228ede4 (2022-09-09-01:28)
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
Info : starting gdb server for rp2040.core0 on 50000
Info : Listening on port 50000 for gdb connections
[2022-09-09T15:28:29.253Z] SERVER CONSOLE DEBUG: GDBServerConsole: onBackendConnect: gdb-server program client error Error: read ECONNRESET
[2022-09-09T15:28:29.254Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
In general, for these types of installation questions, you're likely to get more help by asking at https://forums.raspberrypi.com/viewforum.php?f=143
Done.
https://forums.raspberrypi.com/viewtopic.php?p=2036844