maxgerhardt / platform-raspberrypi

Raspberry Pi: development platform for PlatformIO
Apache License 2.0
94 stars 46 forks source link

problem with Debugging Pico with Pico Debug Probe on MacOS with PlatformIO and VScode #58

Open edwindertien opened 3 months ago

edwindertien commented 3 months ago

I hope this is the right spot to try and get this working. I'm new to using debug tools in platformIO (did use others, AVRstudio etc before). I'm trying to set up the Pi Debug Probe for working with VScode / PlatformIO and Pico on MacOS. So far programming and serial debug using the probe work fine. I use the following platformio.ini:

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower
board_build.filesystem_size = 0.5m
debug_tool = cmsis-dap
debug_speed = 30000
upload_protocol = cmsis-dap
build_type = debug
lib_deps = 
    adafruit/Adafruit NeoPixel
    adafruit/Adafruit SSD1306 ; need to comment out the pgmspace.h
monitor_speed = 115200

However, GDB exits quite quickly without me being able to view anything or set breakpoints. The debug console output shows

undefined/Users/Dertien/.platformio/packages/toolchain-rp2040-earlephilhower/bin/arm-none-eabi-gdb: warning: error finding working directory: Operation not permitted
Reading symbols from /Users/Dertien/Documents/PlatformIO/Projects/PicoFurby/.pio/build/pico/firmware.elf...
Warning: 'set target-async', an alias for the command 'set mi-async', is deprecated.
Use 'set mi-async'.

PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = cmsis-dap
PlatformIO: Initializing remote target...
Open On-Chip Debugger 0.12.0-g4d87f6dca-dirty (2024-01-02-22:17)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
2
Info : Hardware thread awareness created
adapter speed: 30000 kHz

Not sure where the 'undefined' comes from and whether it is serious after initialisation it ends with:

[rp2040.core1] halted due to debug-request, current mode: Thread 
xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00
Start address 0x100030d4, load size 182556
Transfer rate: 51 KB/sec, 12170 bytes/write.
[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
[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
Temporary breakpoint 1 at 0x10006878: file /Users/Dertien/.platformio/packages/framework-arduinopico/cores/rp2040/main.cpp, line 81.
Note: automatically using hardware breakpoints for read-only addresses.
PlatformIO: Initialization completed

Fatal signal: 
Segmentation fault: 11

----- Backtrace -----
Backtrace unavailable
---------------------
A fatal error internal to GDB has been detected, further
debugging is not possible.  GDB will now terminate.

This is a bug, please report it.
  For instructions, see:
<https://www.gnu.org/software/gdb/bugs/>