Skip to content
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

Disjoint array handling issue with Microchip SAM L21 #713

Open
RavuAlHemio opened this issue Mar 4, 2023 · 2 comments
Open

Disjoint array handling issue with Microchip SAM L21 #713

RavuAlHemio opened this issue Mar 4, 2023 · 2 comments
Labels

Comments

@RavuAlHemio
Copy link

RavuAlHemio commented Mar 4, 2023

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!

@burrbull
Copy link
Member

burrbull commented Mar 4, 2023

Looks like regression. Thank you for reporting.

cc @n8tlarsen

@burrbull burrbull added the bug label Mar 4, 2023
@n8tlarsen
Copy link
Contributor

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.

Tremoneck pushed a commit to Tremoneck/atsamd that referenced this issue May 14, 2023
jbeaurivage pushed a commit to jbeaurivage/atsamd that referenced this issue Oct 24, 2023
jbeaurivage added a commit to atsamd-rs/atsamd that referenced this issue Oct 26, 2023
* Update svd2rust and form version

* CreatePatch file for the EVSYS channel

* Regenerate PAC's with svd2rut 0.30.2

* Apply manual patch for wrong generation of svd2rust
See rust-embedded/svd2rust#713

* Update Cargo.toml to the new Versions of the pacs

* Update hal to the new pacs

The Parts changed where adding SELECT to a few Registers ending with
_A, as they were renamed frm *_A to *SELECT_A

* Make the tier one examples compileable

* Update the changelog

* Change the rename in EVSYS to the Channel struct.
This change keeps the register names in sync with the datasheet.

---------

Co-authored-by: Adrian Geipert <[email protected]>
Co-authored-by: Justin Beaurivage <[email protected]>
benvonhandorf pushed a commit to benvonhandorf/atsamd that referenced this issue Nov 29, 2023
* Update svd2rust and form version

* CreatePatch file for the EVSYS channel

* Regenerate PAC's with svd2rut 0.30.2

* Apply manual patch for wrong generation of svd2rust
See rust-embedded/svd2rust#713

* Update Cargo.toml to the new Versions of the pacs

* Update hal to the new pacs

The Parts changed where adding SELECT to a few Registers ending with
_A, as they were renamed frm *_A to *SELECT_A

* Make the tier one examples compileable

* Update the changelog

* Change the rename in EVSYS to the Channel struct.
This change keeps the register names in sync with the datasheet.

---------

Co-authored-by: Adrian Geipert <[email protected]>
Co-authored-by: Justin Beaurivage <[email protected]>
benvonhandorf pushed a commit to benvonhandorf/atsamd that referenced this issue Nov 29, 2023
* Update svd2rust and form version

* CreatePatch file for the EVSYS channel

* Regenerate PAC's with svd2rut 0.30.2

* Apply manual patch for wrong generation of svd2rust
See rust-embedded/svd2rust#713

* Update Cargo.toml to the new Versions of the pacs

* Update hal to the new pacs

The Parts changed where adding SELECT to a few Registers ending with
_A, as they were renamed frm *_A to *SELECT_A

* Make the tier one examples compileable

* Update the changelog

* Change the rename in EVSYS to the Channel struct.
This change keeps the register names in sync with the datasheet.

---------

Co-authored-by: Adrian Geipert <[email protected]>
Co-authored-by: Justin Beaurivage <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants