platform-raspberrypi
platform-raspberrypi copied to clipboard
SVD parser throws error on rp2040.svd file: Unable to parse SVD file: TypeError: Cannot read property ‘0’ of undefined
Hello,
I’m using VSCode and I can’t fully use the debugger with SWD and cmsis-dap on my Raspberry Pi Pico, as it throws an error on the rp2040.svd file: Unable to parse SVD file: TypeError: Cannot read property ‘0’ of undefined. No variables, watches or peripherals can be viewed, as these are defined in the svd file. The debugger starts and functions correctly, but I am only able to see the breakpoints, call stack en registers.
When checking the XML format of the svd file on https://www.freeformatter.com/xml-validator-xsd.html using the https://raw.githubusercontent.com/ARM-software/CMSIS/master/CMSIS/Utilities/CMSIS-SVD.xsd, I get a lot of errors on the svd file. Not sure if that is relevant.
I’m using the simple blinky code.
My platformio.ini:
[env] platform = raspberrypi framework = arduino
[env:pico] board = pico upload_protocol = picotool debug_tool = cmsis-dap
People are helping out on making the svd compliant to the xsd, but so far it does not make any difference. I still get the error and missing debug features.
Any follow up on this? I've compiled the latest raspberry pi openocd version, but it has the same errors. The changes in the SVD did not solve any problems.
I'm using a simple Chinese ST Link v2 DAPLink compatible USB stick, and this works correctly with my STM32 boards. (Aliexpress.com, search for daplink)
This still occurrs even when using the latests rp2040.svd
file. Should be investigated in the parser what's going on, but that doesn't seem to be open-source.
Thanks for the reply Max, long time no follow up although the problem still exists. My opinion is the same as yours, it's most likely something in the parser, so the people working on platformio perhaps should look into it.
Just wanted to comment that the issue still exists, more than a year later, with the latest platformio core (6.1.13).
Thanks to Max' guides - 🙏 , I was able to make my setup of Arduino Nano RP2040 Connect + Raspberry Pi Debug probe start working/debugging.
Every time the debug session starts, the SVD error shows up - note that stepping through the code, breakpoints, variables inspection still work. The peripherals panel is not usable.
I have tried several flavors of the rp2040 SVD file - all with same results:
- https://github.com/platformio/platform-raspberrypi/blob/develop/misc/svd/rp2040.svd
- https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2040/hardware_regs/rp2040.svd
Also note, other SVD files (for different chipsets - e.g. nrf52840) can be loaded fine.
Are we confident the issue is on platformio's core parser side?
Hi @danluca et al., I am facing similar problems (I think) running the latest platformio core (6.1.13) and trying to use a Pico and the Pi Debug probe. almost immediately after initialisation the message
'Unable to parse SVD file: TypeError: Cannot read properties of undefined (reading '0')' pops up,
the debug console throws a warning:
----- 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/>
and that's it. Im running on MacOS. Programming works fine. Starting the debugger from command line (arm-none-eabi-gdb) works fine. Sadly no nice debug tools from VScode.
as platformio.ini I use
[env:pico] platform = https://github.com/maxgerhardt/platform-raspberrypi.git board = pico framework = arduino board_build.core = earlephilhower board_build.filesystem_size = 0m 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
Any obvious mistakes or steps I could take?
The PlatformIO extension being unable to parse the SVD file should not cause GDB to crash -- those are two entirely different programs and GDB doesn't read the SVD file at all. Debugging should be possible, just no peripheral register view. I have not yet seen that one.
Can you modify ~/.platformio/platforms/raspberrypi/boards/pico.json
to remove the "svd":..
line and retry after a clean VSCode restart? (There may be multiple raspberrypi
directories, chose the right one.
There is a line "svd_path": "rp2040.svd" in the pico.json. (which I remove, and after clean start the 'unable to parse SVD file' is no longer there. GBD still crashes.
Then it's independent of the SVD file and should be discussed in https://github.com/maxgerhardt/platform-raspberrypi/issues/.
Thank you, I will