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

Emit alternateGroup element in SVD for registers with multiple modes #48

Merged
merged 3 commits into from
Sep 6, 2023

Conversation

G33KatWork
Copy link
Contributor

@G33KatWork G33KatWork commented Sep 5, 2023

This patch adds the capability to emit an alternateGroup element in the resulting SVD when a register of a peripheral has multiple modes. This is handy for the modern timer peripherals in the atxmegas and new attinys where a timer can be either set to 16 bit single mode or you can split it into two independent 8 bit timers.

The resulting registers are prefixed with the mode already by svd2rust as of version v0.18.0. For example in an attiny817 for peripheral TCA0 there will be single_ctrl{a,b,c} and split_ctrl{a,b,c} registers.

This should fix #30

This patch adds the capability to emit an `alternateGroup` element in
the resulting SVD when a register of a peripheral has multiple modes.
This is handy for the modern timer peripherals in the atxmegas and new
attinys where a timer can be either set to 16 bit single mode or you can
split it into two independent 8 bit timers.

The resulting registers are prefixed with the mode already by `svd2rust`
as of version v0.18.0. For example in an attiny817 for peripheral TCA0
there will be `single_ctrl{a,b,c}` and `split_ctrl{a,b,c}` registers.
Copy link
Owner

@Rahix Rahix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks a lot for the contribution!

Can you also add the ATtiny817 as a regression test in tests/regression.rs please? To do this, you'll need to:

  1. Add the ATDF source file
  2. Add the testcase in the mentioned file
  3. Run cargo insta test to generate the new snapshot
  4. Run cargo insta review to accept the snapshot
  5. Then check in both the ATDF and the snapshot into git.

@G33KatWork
Copy link
Contributor Author

Done. Do you want me to fix the rustfmt fail as well?

@Rahix
Copy link
Owner

Rahix commented Sep 5, 2023

Do you want me to fix the rustfmt fail as well?

Yes please :)

@Rahix Rahix self-requested a review September 6, 2023 12:16
Copy link
Owner

@Rahix Rahix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! :)

@Rahix Rahix merged commit 04f031c into Rahix:main Sep 6, 2023
@G33KatWork G33KatWork deleted the register_groups branch December 14, 2023 09:46
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.

Does not handle attiny412 TCA0 possibly due to split mode
2 participants