-
Notifications
You must be signed in to change notification settings - Fork 156
add code generation support of peripheral arrays #592
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
- generate ArrayProxy of peripherals when const_generic is true - generate separate struct of peripherals when const_generic is false close issue: rust-embedded#492
(rust-highfive has picked a reviewer for you, use r? to override) |
Looks good for me in general. @therealprof any comments? |
Co-authored-by: Zgarbul Andrey <zgarbul.andrey@gmail.com>
It seems that CI use SVD in posborne/cmsis-svd to test. I try searching
My mistake. I don't need to bind it. 🤣 |
for future reference. If you need to break msrv, do it ;) |
I think I have misunderstood how let base = self as *const Self as usize;
let address = base + S * index;
&*(address as *const T) But the generated code when For now, I think maybe there is no need to provide something like |
Instead of |
Yes. For now, the generated code is only organized in this way. Though I think there is no problem, I still want to ask if there are any suggestions. |
I don't have suggestions now. |
bors r+ |
Build succeeded: |
Brief Intro
close issue: #492
Design
Notice: This is my first try of implement this feature. Please provide suggestions for this PR to better implement this feature.
This PR aims to achieve what issue #492 is asking for. This PR implements a basic try of generating codes depending on the
const_generic
flag.Let's say we have an svd file with descriptions of peripherals like this:
If the
const_generic
isfalse
, there is noArrayProxy
. So I generate separate structs and only one mod:NOTICE: The following design is actually incorrect and has been removed. See the following comment.
Since
_array
is a private field ofArrayProxy
, I add anew
method to implement thesteal
method ofPeripherals
.Well, I haven't fully tested this implementation yet. So there may be problems that need to be solved.