Skip to content

No unions #309

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

Closed
wants to merge 23 commits into from
Closed

No unions #309

wants to merge 23 commits into from

Conversation

burrbull
Copy link
Member

Implemented by @wez this PR replace untagged unions with functions for access to alternate registers.

Depends on #308 .

Closes #230, #218, stm32-rs/stm32-rs#149 .

@adamgreig , @therealprof , @Emilgardis , @ryankurte

nsabovic and others added 19 commits August 22, 2018 16:56
This is a very basic first cut at expanding registers with derivedFrom.

This commit requires rust-embedded/svd#50
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
Register derived from (resolve merge conflicts)
@burrbull burrbull requested a review from a team as a code owner July 13, 2019 11:29
@rust-highfive
Copy link

r? @Emilgardis

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-tools labels Jul 13, 2019
burrbull added 4 commits July 15, 2019 10:43
* Introduce a logging system.

svd2rust now uses env_logger instead of printing directly to stderr.
env_logger is currently configured to log messages >= info to stderr.

* Fix import of logging macro.

* Remove some noise in the generated code

Struct initialisations don't need to repeat field names if they're equal
to a local variable.

Signed-off-by: Daniel Egger <[email protected]>
@burrbull burrbull closed this Jul 19, 2019
@burrbull burrbull deleted the no_unions2 branch July 19, 2019 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

save access to unions
5 participants