-
Notifications
You must be signed in to change notification settings - Fork 156
Support registers without a defined reset value #258
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
Conversation
In case no reset value is defined for a register, we suppress generation of the `reset`, and `reset_value` functions. For writable registers which don't have a reset value, we pass the only possible value we could into the closure, a zeroed bitfield. Fixes: rust-embedded#174
Now that there is support for generating code for registers with missing reset values, enable some of the Atmel (now Microchip) SAM processors which had been disabled for this reason.
@japaric @Emilgardis Ping, looking for a review or at least comment on whether this approach looks reasonable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, gonna kick the CI
bors try |
tryBuild succeeded |
I've started working on other things, but using Is this no longer the case? |
As for me, using some non-zero default value for |
The documentation says (with an example):
Using zero as the initial value if the As stated above this PR is a breaking change (changes semantics) and requires an RFC / approval from the team to land. cc @rust-embedded/tools (changing label to S-waiting-on-team) |
I'd agree with the reasoning above and suggest to not accept this PR. @Emilgardis You approved this change, what is your opinion? |
@therealprof We discussed this during the Oxidize and came to a decision of having deprecated |
@Disasm Do we really need to deprecate I'd like to take the opportunity of a working CI to move svd2rust forward a bit in the next time so now would be the right time to propose breaking changes. |
@therealprof I can imagine the following plan:
|
365: fix docs+examples, work without reset, fixes r=therealprof a=burrbull r? @therealprof Add more docs as @Disasm proposed. Restore `unsafe` on `W::bits()` I somewhere lost. Don't generate `write` if `reset_value` is not present. #258 Co-authored-by: Andrey Zgarbul <[email protected]>
Each register has |
I learned about this Using the reset value for |
In case no reset value is defined for a register, we suppress generation
of the
reset
, andreset_value
functions. For writable registers whichdon't have a reset value, we pass the only possible value we could into the
closure, a zeroed bitfield.
This is a rebase of pull request #175 from @ecstatic-morse, along with an implementation of
write
which doesn't depend on the reset value as suggested by @sjroe in #174, and enabling of some tests that cover this case as had been requested in #175. It looks like #175 hasn't been updated in a while, so I figured I'd send a new pull request.Fixes: #174