Closed evilmav closed 3 years ago
You're right, atdf2svd
is violating the spec here... Can you please try out whether #26 yields SVD files that fix usage with the PlatformIO Debugger?
Thank you for your effort! Vscode parser does not crash any more, but does not show peripherials either... I would not bet it's the svd at fault though: I've cut out reduced a sample from the generated SVD for testing:
Peripherials view stays empty, but it starts working if I set addressBlock.size
to 0x4 or above. Unless there is some metadata missing and defaulting to 32bits, this seems more like vscode bug then SVD - chances are it was never tested with anything but ARM... Unfortunately, I can't figure out where their parser code even is...
but it starts working if I set
addressBlock.size
to 0x4 or above.
Yeah that very much sounds like they hard coded a minimum register size of 32 bits or something similar. Not sure if there's anything we can do about it short of a fix on their side...
Agree, just would have been nice to validate it in some way. The issue is in platformio-vscode-debug, for which I can not find the source although it's claimed to be open-sourced. I've created an Issue.
BTW, CMSIS provided SVDConv is claimed to be able to verify SVD files. Unfortunately, I couldn't get it to run without segfault on linux so far.
BTW, CMSIS provided SVDConv is claimed to be able to verify SVD files. Unfortunately, I couldn't get it to run without segfault on linux so far.
Yeah it might be a good idea to validate the output of atdf2svd
, I'm sure this isn't the only spec violation... To be honest we built it to barely emit enough output to make svd2rust
work, with little regard for the actual SVD spec... Maybe there is a machine-readable schema available somewhere which we could compare against a generated file, if SVDConv really fails to run?
There is this: CMSIS-SVD Schema File.
I've fed a generated SVD to it, the output is:
ATmega1284P.svd:2: element device: Schemas validity error : Element 'device': The attribute 'schemaVersion' is required but missing.
ATmega1284P.svd:5: element addressUnitBits: Schemas validity error : Element 'addressUnitBits': This element is not expected. Expected is one of ( series, version ).
ATmega1284P.svd fails to validate
Though the latter error seems to be due to sequence, which is unlikely to confuse a real parser.
PS Tried to run SVDConv from latest CMSIS release on windows. No luck either. Doesn't seem like anyone actually uses this thing ^^
If I can chirp in on this for a brief moment, I think there are good reference SVD files at https://github.com/gicking/STM8_headers for STM8 devices which also have lots of 8-bit registers as the AVR, and these ones were explicitly validated using SVDConv by the author to find all errors -- maybe you can find an error in this converter / source files easier with that.
Interesting. @maxgerhardt, can you confirm that even the registers in register blocks with size less than 4 are showing up from those SVD files?
According to CMSIS-SVD docs:
It seems that generated SVDs are generally missing this element. This breaks e.g. PlatformIO Debugger.