Problem with registers with %s not being expanded.
I'm using the SVD for the LPC4357 which I retrieved from here: https://community.nxp.com/docs/DOC-334628. I had to make some edits of some enum names since the original file causes duplicate symbols.
The problem is with the SGPIO registers which have the form
pub struct RegisterBlock {
#[doc = "0x00 - Pin configuration register for pins P0"]
pub sfsp0_: [SFSP0_; 2],
}
#[doc = "Pin configuration register for pins P0"]
pub struct SFSP0_ {
register: VolatileCell<u32>,
}
I've attached a reduced version of the file the reproduces the problem. LPC43xx_43Sxx_reduce.zip
This is because svd2rust "unrolls" the array/list. This is to make functions taking an %sed register easier to write.
@Emilgardis Yes I understand what it's supposed to do, the issue is that it isn't replacing the %s with anything. I'd expect pub struct SFSP0_0 and pub struct SFSP0_1 blocks rather than just multiple pub struct SFSP0_ blocks.
This could be solved with having svd2rust make a trait SFSP0_, and then generate structs which implement that trait. The only problem with this approach is that we'd need to have an array like [T;2] where T: SFSP0_, which iirc is not possible today.
This isn't really related to #662 but I may be able to offer some insight. In this case svd2rust is not expanding/unrolling the dimElementGroup (identifiers with the %s notation) as suggested, but actually making an array using a common type. Since it uses a common type, that type has to have a name, which in most cases is best given by simply replacing the enumerating token %s with nothing. In your case, the trailing underscore is unfortunate and I might suggest that svd2rust replace it with something interesting like n to denote that the struct is shared by a number of SFSP0_n registers. What do @burrbull and @Emilgardis think?
We already have keep_list cli flag which should give expected in topic behavior.
Reopen if keep_list doesn't work.