Skip to content

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

Closed

Description

@gesture1968

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

Activity

  1. gesture1968 commented on Oct 27, 2021

    @gesture1968
    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.

  2. gesture1968 commented on Nov 19, 2021

    @gesture1968
    Author

    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)

  3. maxgerhardt commented on Jun 9, 2022

    @maxgerhardt
    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.

  4. gesture1968 commented on Jun 10, 2022

    @gesture1968
    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.

  5. danluca commented on Jan 15, 2024

    @danluca

    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?

  6. edwindertien commented on Mar 18, 2024

    @edwindertien

    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?

  7. maxgerhardt commented on Mar 18, 2024

    @maxgerhardt
    Contributor

    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.

  8. edwindertien commented on Mar 18, 2024

    @edwindertien

    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.

  9. maxgerhardt commented on Mar 18, 2024

    @maxgerhardt
    Contributor

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

  10. edwindertien commented on Mar 18, 2024

    @edwindertien

    Thank you, I will

  11. geonicz commented on Mar 11, 2026

    @geonicz

    No updates on topic?
    2026, March. Still rp2040.svd causes parser error and no peripherials available.
    Any guesses how to solve it?

  12. maxgerhardt commented on Mar 11, 2026

    @maxgerhardt
    Contributor

    I have just investigated this issue for the rp2350.svd and found it, in a minimal example, that if a <peripheral> does not have a <description> tag, it fails to load the SVD file. Seems like the parser always expects it although it's optional. Let me see if I can fully fix RP2350 loadidng and do that the same for rp2040.svd.

    Image
  13. maxgerhardt commented on Mar 11, 2026

    @maxgerhardt
    Contributor

    Yes, for rp2350.svd, simply adding back dummy descriptions and removing the last "SPARE_IRQ" perpiheral (which has no defined registers, just interrupt definitions), makes the file loadable in PlatformIO.

    Image

    Now let's see for RP2040..

  14. maxgerhardt commented on Mar 11, 2026

    @maxgerhardt
    Contributor

    Bingo. Completely loadable rp2040.csv file after just adding dummy descriptions.

    Image Image
  15. maxgerhardt commented on Mar 11, 2026

    @maxgerhardt
    Contributor

    Will be fixed by #89 or just download the latest rp2040.svd from https://github.com/maxgerhardt/platform-raspberrypi/blob/patch-2/misc/svd/rp2040.svd and overwrite your old one in C:\Users\<user>\.platformio\platforms\raspberrypi\misc\svd.

  16. geonicz commented on Mar 12, 2026

    @geonicz

    Works like a charm! Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions