-
Notifications
You must be signed in to change notification settings - Fork 156
Open
Labels
Description
Greetings,
I have run into an issue while upgrading my SAM L21 crates. With the SVD file ATSAML21G16B.svd, svd2rust v0.27.2 was successful while v0.28.0 (and current master) lead to the following compilation error:
error[E0412]: cannot find type `PMUX1_0` in this scope
--> src\port.rs:58:19
|
58 | pub pmux1_0: [PMUX1_0; 16],
| ^^^^^^^ help: a type alias with a similar name exists: `PMUX1_`
...
111 | pub type PMUX0_ = crate::Reg<pmux0_::PMUX0__SPEC>;
| -------------------------------------------------- similarly named type alias `PMUX1_` defined here
error[E0412]: cannot find type `PINCFG1_0` in this scope
--> src\port.rs:60:21
|
60 | pub pincfg1_0: [PINCFG1_0; 32],
| ^^^^^^^^^ help: a type alias with a similar name exists: `PINCFG1_`
...
117 | pub type PINCFG0_ = crate::Reg<pincfg0_::PINCFG0__SPEC>;
| -------------------------------------------------------- similarly named type alias `PINCFG1_` defined here
For more information about this error, try `rustc --explain E0412`.
error: could not compile `atsaml21g16b` due to 2 previous errors
In the generated file port.rs
, the block:
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
// [...]
#[doc = "0xb0..0xc0 - Peripheral Multiplexing n - Group 1"]
pub pmux1_: [PMUX1_; 16],
#[doc = "0xc0..0xe0 - Pin Configuration n - Group 1"]
pub pincfg1_: [PINCFG1_; 32],
}
has changed to:
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
// [...]
#[doc = "0xb0..0xc0 - Peripheral Multiplexing n - Group 1"]
pub pmux1_0: [PMUX1_0; 16],
#[doc = "0xc0..0xe0 - Pin Configuration n - Group 1"]
pub pincfg1_0: [PINCFG1_0; 32],
}
A git bisect pointed me to 874f7df. Is this a regression in svd2rust or an error in the SVD file?
Thanks in advance!
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
burrbull commentedon Mar 4, 2023
Looks like regression. Thank you for reporting.
cc @n8tlarsen
n8tlarsen commentedon Mar 6, 2023
Looks like the
deriveFrom
key may be throwing off the type name resolution when used with arrays. I'll take a look at it more in-depth.Apply manual patch for wrong generation of svd2rust
Apply manual patch for wrong generation of svd2rust
Update PAC's to svd2rust 0.30.2 (#683)
Update PAC's to svd2rust 0.30.2 (atsamd-rs#683)
Update PAC's to svd2rust 0.30.2 (atsamd-rs#683)