Skip to content

Absence of <usage> field in SVD file causes an error #282

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

Open
berkut0 opened this issue Mar 11, 2025 · 2 comments
Open

Absence of <usage> field in SVD file causes an error #282

berkut0 opened this issue Mar 11, 2025 · 2 comments

Comments

@berkut0
Copy link

berkut0 commented Mar 11, 2025

I'm using SVD from a chip and this file is in terrible condition (deeply Chinese chip). I found out that there is svdtools, which I have been looking for all this time! This powerful tool will help me to bring this SVD file to a normal state.

But I encountered an error. This is the same bug that appears in svd2rust. I know about it, fixing this problem is where my journey with the SVD file started.

The problem is that some peripherals in the original file do not have a field. This is because these peripherals have unusual fields (e.g. ). Maybe for some other reason, which is probably not important at the moment.

What do I think is the right thing to do? It seems to me that the right thing to do would be to make it a warning. Because in my YAML I have already put it as a correction in the original file. So the logic is: explicitly state that there is a bug in the original file, but let the patch be done. What do you think?

[2025-03-11T14:50:14Z ERROR svdtools::cli] by svdtools (0.4.4)

    Caused by:
        0: In device `deeply_chineese_chip`
        1: In peripheral `ADT0`
        2: Parsing unknown addressBlock at 567:13
        3: Expected a <usage> tag, found none
@burrbull
Copy link
Member

Unfortunately some of bugs in SVD can cause errors of parsing.
Current svdtools uses svd-parser to get Device and than patches it. So input SVD should pass xmllint at least.
Anyway this issue is more related to svd-parser

It is theoretically possible with old python svdtools which modifies XML directly.

@berkut0
Copy link
Author

berkut0 commented Mar 11, 2025

Thank you, @burrbull
I got it, okay.
Edited it by hand, it's only a couple of dozen lines.

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

2 participants