Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVD parser throws error on rp2040.svd file: Unable to parse SVD file: TypeError: Cannot read property ‘0’ of undefined #21

Open
gesture1968 opened this issue Oct 23, 2021 · 10 comments

Comments

@gesture1968
Copy link

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

@gesture1968
Copy link
Author

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.

@gesture1968
Copy link
Author

gesture1968 commented Nov 19, 2021

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)

@maxgerhardt
Copy link
Contributor

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.

@gesture1968
Copy link
Author

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.

@danluca
Copy link

danluca commented Jan 15, 2024

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:

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?

@edwindertien
Copy link

edwindertien commented Mar 18, 2024

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?

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Mar 18, 2024

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.

@edwindertien
Copy link

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.

@maxgerhardt
Copy link
Contributor

Then it's independent of the SVD file and should be discussed in https://github.com/maxgerhardt/platform-raspberrypi/issues/.

@edwindertien
Copy link

Thank you, I will

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants