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

Add cargo build support #5

Closed
wants to merge 2 commits into from
Closed

Add cargo build support #5

wants to merge 2 commits into from

Conversation

tones111
Copy link
Contributor

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.

@tones111
Copy link
Contributor Author

tones111 commented Apr 26, 2018

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.

@tones111
Copy link
Contributor Author

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.
@tones111
Copy link
Contributor Author

tones111 commented Feb 1, 2019

Pinging @adamgreig for another look please. Thanks.

@tones111
Copy link
Contributor Author

tones111 commented Mar 7, 2019

Pinging @adamgreig for feedback on this changeset please.

@gkelly
Copy link

gkelly commented Jan 18, 2020

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 stm32f7 = {git ... as a dependency.

@adamgreig
Copy link
Member

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!

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.

None yet

3 participants