-
Notifications
You must be signed in to change notification settings - Fork 216
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
Add cargo build support #5
Conversation
This PR has been updated to not generate internal modules since only one device feature is allowed at a time. Clippy build.rs support has been added and assiciated fixes made. The svd2rust dependency has now been internalized so the user no longer needs it in their path. The only external dependencies to build are the python support for svdpatch.py and the nightly version of rustfmt. |
With rust-embedded/svd2rust#267 landing, I've brushed off some of the dust from this effort. Hopefully this simplifies crate maintenance and makes downstream usage more consistent. |
The motivation for this change is to internalize the svd2rust dependency and allow any downstream dependencies to point to the same crate.
Pinging @adamgreig for another look please. Thanks. |
Pinging @adamgreig for feedback on this changeset please. |
I think this is a useful change, especially for users at the bleeding edge who want to use devices not yet in releases (stm32f730 in my case) who then need to clone and follow build instructions and then reference the crate locally instead of just having |
After a lot of thinking about this I've decided to not include it in stm32-rs. I don't think having end users generate the modified SVD, then generate the PAC, and then finally build it is the way to go. We've got the crates.io builds for most users, and the new stm32-rs nightlies which should allow using the latest master as a git dependency, so I think most use cases are covered. Thank you regardless for putting the PR together, and apologies that it's taken almost two years to decide! |
This change adds a cargo build script to allow dependent crates to specify stm32 as a Cargo.toml dependency. Cargo can also be used to build within the repository with something like...
cargo build --features 'rt stm32f303'
It does depend on a svd2rust PR
rust-embedded/svd2rust#202
This support only allows one device feature to be specified (otherwise duplicate statics prevent compilation). The build.rs script will panic if it detects too many devices.