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

Don't crash on enum usage tag #12

Merged
merged 2 commits into from
Aug 22, 2024
Merged

Don't crash on enum usage tag #12

merged 2 commits into from
Aug 22, 2024

Conversation

auxym
Copy link
Collaborator

@auxym auxym commented Aug 22, 2024

Resolves #10

The SVD spec allows optionally definining two different enumeratedValues sets by using the usage tag to specify read or write usage. This feature appears to be very rarely used in the wild and thus is not currently supported by svd2nim.

At the moment, svd2nim crashes with an exception if the usage tag is encountered. However, patched stm32 SVD files from the embedded rust project appear to use usage in some cases even if a single enum is defined.

As a quick workaround, this PR removes the check for the usage tag. Instead, throw a warning if multiple enum entries are used and just use the first entry for code gen.

Code generation for separate read/write enums can be implemented in the future if anyone actually needs it, please open a new issue.

auxym added 2 commits August 20, 2024 21:50
Instead, throw a warning if multiple enum entries are used and just use
the first entry for code gen. Separate r/w enums can be implemented in
the future if needed.
@auxym auxym merged commit 34d9a66 into master Aug 22, 2024
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

Successfully merging this pull request may close these issues.

Translating patched stm32f429.svd results in exception
1 participant