-
Notifications
You must be signed in to change notification settings - Fork 156
Compilation fails on generated file with '%s' #27
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
That SVD file contains stuff like this: <register>
<dim>8</dim>
<dimIncrement>0x100</dimIncrement>
<dimIndex>0,1,2,3,4,5,6,7</dimIndex>
<name>PRS%s</name> which represents an array of registers. So svd2rust should actually expand that to something like this: struct Axbs {
prs: Prs[8],
}
struct Prs {
register: u32,
padding: [u8; 224],
}
impl Prs { /* read, write, modify methods */ } but that hasn't been implemented yet. Actually, I just realized that sort of array encoding exists 😄. |
@japaric shouldn't this be struct Axbs {
prs: [Prs; 8],
}
struct Prs {
register: u32,
padding: [u8; 252],
} ? Note the padding (dimIncrement is specified in bytes whereas the register size is in bits). |
@istankovic Possibly, I didn't actually look at the units. |
This was implemented in #43 |
I've tried to generate *.rs from MK70F15.xml.txt (I added 'txt' extension to satisfy github, I believe it is SVD file, I found it here).
Output file generated successfully (some warnings though):
But following error appeared on compilation:
Probably svd2rust should somehow convert '%s' in SVD into something legal for Rust.
The text was updated successfully, but these errors were encountered: