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 fails for ATMega files with "TypeError: Cannot read property '0' of undefined" #2368

Open
maxgerhardt opened this issue Feb 10, 2021 · 2 comments
Labels
bug debug PIO Unified Debugger

Comments

@maxgerhardt
Copy link

maxgerhardt commented Feb 10, 2021

See platformio/platform-atmelavr#238 for the SVD files that this occurrs with. Tested with the Arduino Uno json file as described. platformio.ini and code as per this. If this is resolved, we would have a peripheral views for the Atmel chips, and therefore getting closer to what Atmel Studio offers.

grafik

On a sidenote, when loading the SVD files in CLion (in the "Peripherals" tab for a "PlatformIO Debug" target), it doesn't complain

grafik

And can read out some registers / addresses (but the wrong value?! They don't make sense as 32-bit values), but fails to read out the I/O registers. Probably becauase AVR memory spaces are weird and it's using the wrong commands to read them from the SRAM space (and not the Flash space) or avr-gdb has a bug or avr-stub has a bug.

grafik

@evilmav
Copy link

evilmav commented Jun 7, 2021

It was obvious it is missing some element when parsing the XML of the SVD. By trial-and-error in comparison with a working SVD I've found that the error disappears when something like

      <addressBlock>
        <offset>0xNN</offset>
        <size>0xNN</size>
        <usage>registers</usage>
      </addressBlock>

Is included under <peripherial>, which seems missing from the generated files (or at least the one I've been playing with).

@devilman3d
Copy link

This is also presents a problem debugging on RP2040 hardware: https://github.com/platformio/platform-raspberrypi/issues/21.

If it helps, I have been hacking on that minified extension.js and narrowed the problem to strange indexing in loadSVD and parse* in PeripheralTreeProvider. It looks to be taking the first character of the input strings rather than the strings themselves. Is it expecting an array? Also, the function that parses integers depending on prefix needs validation on the input.

I vote for #2587...

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

No branches or pull requests

4 participants