Repository navigation
changed(pacs)!: Build PACs on demand and update PAC APIs - #1013
Conversation
167d35a to
04d03bc
Compare
c9a0eea to
fd2ec96
Compare
|
|
||
| /// Get the chip name from the PAC package name | ||
| fn get_chip_name(pkg_name: impl AsRef<str>) -> Option<String> { | ||
| let re = regex::Regex::new(r"atsam[a-z]\d{2}[a-z]+").unwrap(); |
There was a problem hiding this comment.
I think to allow for easier addition of future chips (PIC series), we should have another way of expressing this?
There was a problem hiding this comment.
Fixed, the chip names are now specified in the Cargo.toml package metadata instead of trying to parse them with regex.
rnd-ash
left a comment
There was a problem hiding this comment.
Overall really happy with this, just a couple minor thoughts I've left, but nothing major.
Its also great to see all peripheral register writes are far more clearer, and are now correct with how the datasheets say to modify certain registers (For example interrupt registers)
The only outstanding question I have is what is with the feature flags being changed on all the PACs to include <PAC>/critical-section feature flag?
|
Great! To answer your question, the newer versions of svd2rust rely on |
ef7e9e1 to
f9ab938
Compare
Also remove patches which have been fixed in the upstream SVDs
848cab7 to
8dd009e
Compare
Summary
The pre-generated PACs sitting in the repo have always been a pain point. This PR enables generating the PAC code at build-time using a build.rs scripts, which enormously reduces the number of files in the PAC crates. It also means we no longer need to run an
update-pacsscript whenever we update SVDs orsvd2rustversion, which is now a build-time dependency.Currently the
svd2rustdependency is at 0.37.1, which is the latest version.I created a new helper library,
atsamd-hal-pacs-builder, which contains the PAC generation code. It also usessvdtools, and much nicer YAML-based SVD patch templates rather than XSLT, which don't have good, pure-rust library offerings. The individualbuild.rsscripts just contain glue to call the codegen function. The PACs'lib.rsis now just this:I also updated the SVDs to the latest version provided by Microchip. As of right now, SAMD21 and SAMD51 devices are using official SVD releases from Microchip. The others use unofficial releases provided to us by Microchip while waiting for them to be officially released.
The new SVD+svd2rust combo brings in relatively significant API changes, so this will be a breaking change for PACs and the HAL.
Notes
We are also waiting forsvd-parser released!svd-parserto make a new release. We need these changes to be released to crates.io for the new PACs to be accepted bysvd2rust. Currently I'm patching the dependency to the git version in the workspaceCargo.toml, but I don't think that's allowed if we want to releaseatsamd-hal-pacs-builderto crates.io.Checklist
svd-parserrelease > 0.14.10