-
Notifications
You must be signed in to change notification settings - Fork 156
save access to unions #230
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
Comments
This removes any observable side effect of the --nightly switch by removing the use of unions and the untagged_unions feature gate. Unions are replaced with accessor functions that return the appropriate register block reference. Here's a playground link that shows that the pointer calculation looks reasonable: https://play.integer32.com/?version=stable&mode=debug&edition=2018&gist=cd56444abc03e6781e526bbddc7082bc This commit is a breaking change. This is based on this WIP PR branch: rust-embedded#256 It implements the easiest standalone portion of this issue: rust-embedded#218 and also makes accessing the unions "safe" too, which is requested here: rust-embedded#230
I'm taking a stab at this in https://github.com/wez/svd2rust/tree/no_unions |
You forgot to add _reserved_ccmr1_output: [u8; 4usize], in RegisterBlock in place of removed union registers. |
@burrbull oh, that's bad. Can you point me to the svd file you're using? That doesn't happen with the ATSAMD files I'm using and I'd like to make sure this is working |
ah, never mind, I can see that it is happening here |
pushed a fix; thanks for catching that! |
This removes any observable side effect of the --nightly switch by removing the use of unions and the untagged_unions feature gate. Unions are replaced with accessor functions that return the appropriate register block reference. Here's a playground link that shows that the pointer calculation looks reasonable: https://play.integer32.com/?version=stable&mode=debug&edition=2018&gist=cd56444abc03e6781e526bbddc7082bc This commit is a breaking change. This is based on this WIP PR branch: rust-embedded#256 It implements the easiest standalone portion of this issue: rust-embedded#218 and also makes accessing the unions "safe" too, which is requested here: rust-embedded#230
318: No unions3 r=therealprof a=burrbull Implemented by @wez this PR replace untagged unions with functions for access to alternate registers. Closes #230, #218, stm32-rs/stm32-rs#149 . cc @therealprof Co-authored-by: Wez Furlong <[email protected]>
With --nightly option svd2rust now can generate unions:
I think it makes sense to add save access to contents.
Something like:
The text was updated successfully, but these errors were encountered: