rust-embedded / svd2rust

Generate Rust register maps (`struct`s) from SVD files
Apache License 2.0
687 stars 149 forks source link

Use `critical_section` for `Peripherals::take`. #651

Closed reitermarkus closed 2 years ago

reitermarkus commented 2 years ago
rust-highfive commented 2 years ago

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @therealprof (or someone else) soon.

Please see the contribution instructions for more information.

adamgreig commented 2 years ago

I'm a bit concerned about what this means for platforms that don't have critical-section support yet. I know msp430 is working on it but having some codegen size issues, and I don't know anything about mips_mcu. It might be worth waiting a little longer for those architectures to get support before releasing svd2rust that uses it?

Having it as an optional dependency/feature seems useful though and does mean those platforms don't need immediate critical-section support, even end-users could add simple interrupt-based implementations to use take() if needed.

reitermarkus commented 2 years ago

It might be worth waiting a little longer

I don't think it's worth waiting. Other architectures will have to implement these only once they upgrade svd2rust anyways. I have opened issues for the affected architectures to give them a heads up though.

adamgreig commented 2 years ago

Oh, thanks, I didn't see the edit to the first comment. SGTM to me then.

bors[bot] commented 2 years ago

Build succeeded: