pico-feedback
pico-feedback copied to clipboard
VSCode Debugging of Introductory Program *Fail*
Hiyas everyone, :-)
I've been following the tutorial in the Introduction to the Pico book and I have run into a problem... I have searched for a solution but nothing has worked so far... I found a repeat of the problem from last year in one of the archives ( I also commented the below in that thread but it was closed so I am opening a new one.)
In short attempting to debug in VSCode results in an error:
Failed to launch OpenOCD GDB Server: Error: spawn /usr/local/bin EACCES
Previous developer comment was as follows: "Should be resolved with documentation updates since originally posted."
I'm afraid not...I still get the same problem and I have tried to follow every tutorial as closely as possible. Its positively doing my nut. I know it has to be something inside vscode, or a vscode configuration file, somewhere because I can execute them all from the command line and they run...there are also a couple of extra flags being reported on the launch of gdb-multiarch which I cannot find defined anywhere so I know that they have to have been sourced from somewhere other than my paltry config files.
Here is the error output minus the popup window:
Cortex-Debug: VSCode debugger extension version 1.12.0 git(d7a405a). Usage info: https://github.com/Marus/cortex-debug#usage
Reading symbols from /usr/bin/arm-none-eabi-objdump --syms -C -h -w /home/rabbit/workspace/RP2040/pico/pico-examples/build/hello_world/serial/hello_serial.elf
Reading symbols from /usr/bin/arm-none-eabi-nm --defined-only -S -l -C -p /home/rabbit/workspace/RP2040/pico/pico-examples/build/hello_world/serial/hello_serial.elf
Launching GDB: gdb-multiarch -q --interpreter=mi2
1-gdb-version
Launching gdb-server: /usr/local/bin -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /home/rabbit/workspace/RP2040/pico/pico-examples -s /usr/local/bin/tcl -c "adapter speed 5000" -f /home/rabbit/.vscode/extensions/marus25.cortex-debug-1.12.0/support/openocd-helpers.tcl -f /interface/cmsis-dap.cfg -f /target/rp2040.cfg
Please check TERMINAL tab (gdb-server) for output from /usr/local/bin
Failed to launch OpenOCD GDB Server: Error: spawn /usr/local/bin EACCES
Here are my launch and settings files:
launch.json :
{
"version": "0.2.0",
"configurations": [
{
"name": "Pico Debug",
"showDevDebugOutput": "raw",
"device": "RP2040",
"gdbPath": "gdb-multiarch",
"cwd": "${workspaceRoot}",
"executable": "${command:cmake.launchTargetPath}",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"configFiles": [
"/interface/cmsis-dap.cfg",
"/target/rp2040.cfg",
],
"searchDir": [
"${workspaceRoot}",
"${env:OPENOCD_PATH}/tcl",
],
"openOCDPreConfigLaunchCommands": ["adapter speed 5000"],
"svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
"runToEntryPoint": "main",
"postRestartCommands": [
"break main",
"continue",
],
}
],
}
Here is my settings.json:
{
// 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.objdumpPath": "/usr/bin/arm-none-eabi-objdump",
"cortex-debug.gdbPath": "gdb-multiarch",
"cortex-debug.openocdPath": "/usr/local/bin",
}
here is the output from the command line:
$ openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "program hello_serial.elf verify reset exit"
Open On-Chip Debugger 0.12.0-g4d87f6d (2023-09-06-19:17)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Hardware thread awareness created
Info : Hardware thread awareness created
adapter speed: 5000 kHz
Info : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E6616407E3804629
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 0 SWDIO/TMS = 0 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0
Info : CMSIS-DAP: Interface ready
Info : clock speed 5000 kHz
Info : SWD DPIDR 0x0bc12477, DLPIDR 0x00000001
Info : SWD DPIDR 0x0bc12477, DLPIDR 0x10000001
Info : [rp2040.core0] Cortex-M0+ r0p1 processor detected
Info : [rp2040.core0] target has 4 breakpoints, 2 watchpoints
Info : [rp2040.core1] Cortex-M0+ r0p1 processor detected
Info : [rp2040.core1] target has 4 breakpoints, 2 watchpoints
Info : starting gdb server for rp2040.core0 on 3333
Info : Listening on port 3333 for gdb connections
[rp2040.core0] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00
[rp2040.core1] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00
** Programming Started **
Info : Found flash device 'win w25q16jv' (ID 0x001540ef)
Info : RP2040 B0 Flash Probe: 2097152 bytes @0x10000000, in 32 sectors
Info : Padding image section 1 at 0x10005994 with 108 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x10005a00 .. 0x1000ffff
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked
(base) rabbit@Core7:~/workspace/RP2040/pico/pico-examples/build/hello_world/serial$
Now trying to start the server:
(base) rabbit@Core7:~/workspace/RP2040/pico/pico-examples/build/hello_world/serial$ openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000"
Open On-Chip Debugger 0.12.0-g4d87f6d (2023-09-06-19:17)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Hardware thread awareness created
Info : Hardware thread awareness created
adapter speed: 5000 kHz
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E6616407E3804629
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 0 SWDIO/TMS = 0 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0
Info : CMSIS-DAP: Interface ready
Info : clock speed 5000 kHz
Info : SWD DPIDR 0x0bc12477, DLPIDR 0x00000001
Info : SWD DPIDR 0x0bc12477, DLPIDR 0x10000001
Info : [rp2040.core0] Cortex-M0+ r0p1 processor detected
Info : [rp2040.core0] target has 4 breakpoints, 2 watchpoints
Info : [rp2040.core1] Cortex-M0+ r0p1 processor detected
Info : [rp2040.core1] target has 4 breakpoints, 2 watchpoints
Info : starting gdb server for rp2040.core0 on 3333
Info : Listening on port 3333 for gdb connections
...Okay server is started and waiting for gdb-multiarch:
(base) rabbit@Core7:~/workspace/RP2040/pico/pico-examples/build/hello_world/serial$ gdb-multiarch hello_serial.elf
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hello_serial.elf...done.
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
time_reached (t=...)
at /home/rabbit/workspace/RP2040/pico/pico-sdk/src/rp2_common/hardware_timer/include/hardware/timer.h:116
116 uint32_t hi_target = (uint32_t)(target >> 32u);
(gdb) monitor reset init
[rp2040.core0] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00
[rp2040.core1] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00
(gdb) continue
Continuing.
and of course I can see "Hello World" in my minicom...
I cannot seem to find where I've gone wrong anywhere...other than choosing to use another microsoft product with their typically rubbish documentation.
Can someone please point out where I'm doing something stupid...I've been at this for over two weeks now.
Cheers, Hannah