-
Notifications
You must be signed in to change notification settings - Fork 151
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
WIP: Register derivedFrom and svd updates #256
Conversation
This is a very basic first cut at expanding registers with derivedFrom. This commit requires rust-embedded/svd#50
bors try |
tryBuild failed |
Note, I believe this failure may be a regression of
CC @ryankurte @Emilgardis, I'll dig in to this a bit, and if I find anything, I'll report it upstream to |
I'd like @wez to review this before merging, to make sure this change is still necessary. There's some confusion described in nrf-rs/nrf52832-pac#11 (comment) |
63: Make the schema field optional r=Emilgardis a=jamesmunns Some devices that have created fake SVDs, such as for the MSP430, may not have schemas listed. This fixes the error seen with https://travis-ci.org/rust-embedded/svd2rust/jobs/456451847, See also rust-embedded/svd2rust#256 (comment) Co-authored-by: James Munns <james.munns@ferrous-systems.com>
63: Make the schema field optional r=Emilgardis a=jamesmunns Some devices that have created fake SVDs, such as for the MSP430, may not have schemas listed. This fixes the error seen with https://travis-ci.org/rust-embedded/svd2rust/jobs/456451847, See also rust-embedded/svd2rust#256 (comment) Co-authored-by: James Munns <james.munns@ferrous-systems.com>
63: Make the schema field optional r=Emilgardis a=jamesmunns Some devices that have created fake SVDs, such as for the MSP430, may not have schemas listed. This fixes the error seen with https://travis-ci.org/rust-embedded/svd2rust/jobs/456451847, See also rust-embedded/svd2rust#256 (comment) Co-authored-by: James Munns <james.munns@ferrous-systems.com>
63: Make the schema field optional r=Emilgardis a=jamesmunns Some devices that have created fake SVDs, such as for the MSP430, may not have schemas listed. This fixes the error seen with https://travis-ci.org/rust-embedded/svd2rust/jobs/456451847, See also rust-embedded/svd2rust#256 (comment) Co-authored-by: James Munns <james.munns@ferrous-systems.com>
ping @wez |
Sorry; have been swamped over the Thanksgiving holidays. I'll take a look over the weekend |
I tested this with https://github.com/atsamd-rs/atsamd/blob/master/update.sh and am sorry to report that it doesn't appear to correctly generate the pmux array. If you run that script and then It's not clear to me what the cause of this is; it looks like you pulled in the commits that made it work as-is, and then made some seemingly unrelated changes, so I suspect that something else changed in svd2rust or svd that needs to be accounted for. I didn't have time to fully dig into this |
Ok, I traced the issue; the SVD file declares derivedFrom as an attribute:
In my original commit to svd: wez/svd@211ae3e this was being extracted correctly, but in the current svd code this appears to have been accidentally refactored to look at a child element instead. This patch to the svd parser is needed to fix things:
|
Ahh, looks like I got that wrong when refactoring svd, sorry! @wez are you up for opening a PR on svd to fix that (and presumably the corresponding encode function)?, otherwise I can put it on my list. |
…to register-derived-from
Register derived from (resolve merge conflicts)
bors try ::Ninja Edit |
hmm bors queue says pending, but there's a crash in the log. i found a closed issue about not working with branch protection on the staging branch, but, i'm not sure why that would be an issue in this instance. bors try |
tryAlready running a review |
bors try- bors try |
tryBuild succeeded |
* 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 <daniel@eggers-club.de>
@jamesmunns Mind rebasing this? |
Conflicts? Again? |
@burrbull Yeah, just got two PRs merged, that's the one in |
cc @jamesmunns |
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
319: register Derived from r=therealprof a=burrbull First three commits from #256 . cc @therealprof Co-authored-by: Nebojsa Sabovic <nsabovic@gmail.com> Co-authored-by: Wez Furlong <wez@wezfurlong.org> Co-authored-by: Andrey Zgarbul <zgarbul.andrey@gmail.com>
Closing in preference of #319 which incorporates this PR. |
This PR extends #193 (edit: and #190), and also brings support for the changes made in
svd-parser
, primarily understanding theRegisterCluster
type.