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

svdtools: install rust version #174

Merged
merged 2 commits into from
Jan 7, 2025
Merged

svdtools: install rust version #174

merged 2 commits into from
Jan 7, 2025

Conversation

tones111
Copy link
Contributor

@tones111 tones111 commented Jan 5, 2025

This change removes a dependency on python/pip and is more consistent with the installation of the other supporting tools.

@tones111 tones111 force-pushed the rust_svdtools branch 3 times, most recently from a1d19f0 to 7a7ce07 Compare January 5, 2025 17:54
@tones111
Copy link
Contributor Author

tones111 commented Jan 5, 2025

The CI needs the cache cleared but I'm not familiar with how to do that.

@Rahix
Copy link
Owner

Rahix commented Jan 5, 2025

You have to bump this cache key to have CI generate a new tools cache:

key: rust-tools-20250104-001

@tones111 tones111 marked this pull request as draft January 5, 2025 20:15
@tones111
Copy link
Contributor Author

tones111 commented Jan 5, 2025

The initial effort was a little too ambitious as there have been some breaking changes to the patch file processing. I'd like to compare against the current patched svd files, but I haven't managed to get the python version of svdtools to build. Is there somewhere I could download them from?

@Rahix
Copy link
Owner

Rahix commented Jan 5, 2025

You can download the CI artifacts from main branch, e.g. here: https://github.com/Rahix/avr-device/actions/runs/12615563082/artifacts/2386623070

@Rahix
Copy link
Owner

Rahix commented Jan 5, 2025

Do post the the diff of the generated svds in this pull request please :)

@Rahix
Copy link
Owner

Rahix commented Jan 6, 2025

@tones111, check the changes in this PR https://github.com/Rahix/avr-device/pull/157/files, I think a large part of the patch file porting has already been done there.

@tones111
Copy link
Contributor Author

tones111 commented Jan 6, 2025

Took a bit to figure out the yaml syntax and why it was complaining but the changes to resolve ended up being pretty straightforward. I committed the generated svd files, so once we've looked at them I will remove it.

When comparing against the svd files @Rahix linked above there were some formatting improvements. Running the original patched files through xmllint --format really helped. Doing some spot checks it looks like the main difference is that the new svdtools removes the <usage>...</usage> from enumerated values (which makes sense).

@tones111
Copy link
Contributor Author

tones111 commented Jan 6, 2025

avr-device.svd.diff.txt

Here's the diff against an xmllint version of 0.7.0. I see the following differences:

  • <usage>...</usage> removed from enumerals
  • improved description whitespace
  • unicode improvements (ex: atmega128rfa1)
  • Some ISC1 interrupt enumerals are removed (ex: attiny167, attiny2313, etc)
  • Some ADC enumerals are reordered in attiny84

@Rahix
Copy link
Owner

Rahix commented Jan 6, 2025

Some ISC1 interrupt enumerals are removed

They are removed because the derived enumerals from ISC0 already include properly named values for them. This is still a breaking change, but one we do want in my eyes.

Some ADC enumerals are reordered in attiny84

Looks okay to me.


As a final check, you can diff the generated rust sources of each version. You can find the original ones in the crate archive contained in target/package/ dir of the artifacts archive. The .crate file is just a .tar.gz archive of the sources.

I would expect this diff to only show the whitespace changes and the removed ISC1 enumerated values.

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.

Changes look fine, after the aforementioned cross-check of the generated sources and removal of the comitted SVDs, this is ready for merge :)

BTW, comitting the SVDs wasn't necessary - CI again created an artifacts archive that includes them for your PR: https://github.com/Rahix/avr-device/actions/runs/12625939793?pr=174

@Rahix
Copy link
Owner

Rahix commented Jan 6, 2025

Ah, just noticed svdtools version 0.4.0 is hot off the stove, maybe we can update this PR to the new version immediately to reduce work later on? :)

This change removes a dependency on python/pip and is more consistent
with the installation of the other supporting tools.
@tones111
Copy link
Contributor Author

tones111 commented Jan 6, 2025

Here's a new diff (against main svds) for the update to svdtools 0.4.0.
svdtools_040.diff.txt

A few more tweaks were required that resulted in some minor corrections

  • updated atmega328pb TWAM1 description
  • atmega8 UPE field is named PE (matches datasheet)
  • attiny841 ACO{0,1} are read-only (matches datasheet)

However, it looks like the timer enum changes from #173 aren't working but I'm not sure why.

@tones111 tones111 marked this pull request as ready for review January 6, 2025 23:41
@tones111
Copy link
Contributor Author

tones111 commented Jan 7, 2025

Maybe the atmega128rfa1 enum changes are there. The svd file has

<enumeratedValues derivedFrom="COM0B"/>

and the COM0B looks like it matches the patch file. So, I think the new version of svdtools knows how to deduplicate the enums.

Update: Ah, this is the same as the ISC1 enumerals above. As you mention, it knows that there are no changes from the derived enum.

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 so much for taking care of this!

@Rahix Rahix merged commit a462c58 into Rahix:main Jan 7, 2025
2 checks passed
@tones111 tones111 deleted the rust_svdtools branch January 7, 2025 23:35
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.

2 participants