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

Re-generate register mappings with svd2rust 0.30.2 #46

Merged
merged 3 commits into from
Mar 4, 2024

Conversation

Ironedde
Copy link
Contributor

@Ironedde Ironedde commented Mar 1, 2024

Why do we want to do this?

In the past we have introduced build and/or clippy fixes ourselfs
through individual patches. Some of these include:

fa62200 Fix clippy::unnecessary_cast, added in svd2rust 0.27.0)
e50754a Fix clippy::explicit_auto_deref, added in svd2rust 0.27.0)
c4a8906 Added Eq implementation, added in svd2rust 0.26.0

But since all these have been added up until svd2rust 0.30.2, and beacuse clippy::missing_safety_doc has started causing our PR's to fail CI, it makes sense to step up the mappings and make use of the new changes.

What is changing?

Since we are stepping the version of the generating tool of the register mappings themselfs, we can expect there to be some breaking changes here.
One example is in mcan::reg::psr::LEC_A which changes name to LECSELECT_A.

The API for the main functionality of the mcan crate will be left unchanged and hopefully this will mean that most users don't need to spend much time to update their codebase.

How do we accomplish this?

Since we have modified some structures in the generated code to fit with our use case there are some manual additions we need to make after we use svd2rust and form.

So the full process becomes:

  1. Create a SVD export using svd2rust 0.30.2 and form 0.10.0
  2. Copy generic.rs to mcan/src/reg/
  3. Copy generic/ to mcan/src/reg/
  4. Overwrite rxf{a,c,s}.rs with rxf0{a,c,s}.rs
  5. Re-apply the merge the two FIFO queues (57d1266)
  6. Re-apply fix for docs relating to the move into reg module, along
    with wrong docs for tdcr (2dcd7a3)
  7. Re-apply the item-level docs for generics.rs
  8. Remove customer specific register information from cust.rs
  9. Fix build errors that was caused by the svd2rust update

Note: This update is based on the SVD file used by the atsame51n pac
crate (0.13.0).
There are newer files available, but these does not contain changes that concerns the MCAN peripheral.

Thank you!

Thank you for your contribution.
Please make sure that your submission includes the following:

Must

  • The code compiles without errors or warnings.
  • All tests pass and in the best case you also added new tests.
  • cargo +stable fmt was run.
  • cargo +stable clippy yields no warnings.
  • Your changes were added to the CHANGELOG.md in the proper section.
  • You add a description of your work to this PR.
  • You added proper docs (in code, rustdoc and README.md) for your
    newly added features and code.

Ironedde added 3 commits March 1, 2024 15:11
In the past we have introduced build and/or clippy fixes ourselfs
through individual patches. Some of these include:

fa62200 Fix clippy::unnecessary_cast, added in svd2rust 0.27.0)
e50754a Fix clippy::explicit_auto_deref, added in svd2rust 0.27.0)
c4a8906 Added Eq implementation, added in svd2rust 0.26.0

But since all these have been added up until svd2rust 0.30.2, and
beacuse `clippy::missing_safety_doc` has started causing our PR's to
fail CI, it was decided to make a step in svd2rust versions.

Summary of changes in this commit:
* Create a SVD export using svd2rust 0.30.2 and form 0.10.0
* Copy generic.rs to mcan/src/reg/
* Copy generic/ to mcan/src/reg/
* Overwrite rxf{a,c,s}.rs with rxf0{a,c,s}.rs

Note: This update is based on the SVD file[1] used by the atsame51n pac
crate (0.13.0)

[1]
https://github.com/atsamd-rs/atsamd/blob/b138702539afa9ec12f17aa5b2765f59289b83ce/svd/ATSAME51N19A.svd
* Re-apply the merge the two FIFO queues (57d1266)
* Re-apply fix for docs relating to the move into reg module, along
  with wrong docs for tdcr (2dcd7a3)
* Re-apply the item-level docs for `generics.rs`
* Remove customer specific register information from `cust.rs`
* Fix build errors that was caused by the svd2rust update
@Ironedde Ironedde requested review from epontan and vcrn March 1, 2024 15:53
@Ironedde Ironedde requested a review from a team as a code owner March 1, 2024 15:53
Copy link
Collaborator

@epontan epontan left a comment

Choose a reason for hiding this comment

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

Looks great, @Ironedde! Well done 👍

Copy link

@vcrn vcrn left a comment

Choose a reason for hiding this comment

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

Looks good, well done!

@epontan epontan merged commit af11f87 into GrepitAB:master Mar 4, 2024
5 checks passed
Ironedde added a commit to Ironedde/mcan-clone that referenced this pull request Mar 4, 2024
- Add safe way to shutdown the bus when actively transmitting/receiving
(GrepitAB#45)
- Add method to finalize configuration into initialization mode (GrepitAB#47)

- *Breaking* Update the register mappings with svd2rust 0.30.2 and
form 0.10.0 (GrepitAB#46)
@Ironedde Ironedde mentioned this pull request Mar 4, 2024
7 tasks
Ironedde added a commit to Ironedde/mcan-clone that referenced this pull request Mar 4, 2024
- Add safe way to shutdown the bus when actively transmitting/receiving
(GrepitAB#45)
- Add method to finalize configuration into initialization mode (GrepitAB#47)

- *Breaking* Update the register mappings with svd2rust 0.30.2 and
form 0.10.0 (GrepitAB#46)
Ironedde added a commit that referenced this pull request Mar 4, 2024
### Added
- Add safe way to shutdown the bus when actively transmitting/receiving
(#45)
- Add method to finalize configuration into initialization mode (#47)

### Changed
- *Breaking* Update the register mappings with svd2rust 0.30.2 and form
0.10.0 (#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.

3 participants