-
Notifications
You must be signed in to change notification settings - Fork 157
Handling disjoint arrays #660
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
I don't have a clear opinion about this. |
I looked through the CMSIS SVD specification and couldn't find anything saying the description used for the R7FA2E1A9.svd ELSR* registers is invalid. In fact running the SVD file through the CMSIS SVDConv tool generates the following C struct:
Which takes the same approach as option 2 above, albeit without svd2rust's typing of registers and fields. Granted in this example the array would have to be expanded anyway because the the register size is smaller than the My opinion is usually to let my tools do the most work they can. In this case the alternative would be to manually go back and patch each ELSR* register present with |
How |
Strangely enough, after looking through a few other examples |
I'm not opposite to support this, specifically option 2. |
In total this feature adds about 350 lines of code which is mostly contained to a single function |
662: Disjoint arrays r=burrbull a=n8tlarsen Solution 2 for #660 which pre-parses ERC type names and provides expansion information to the render functions. Works great with a few SVDs from the [Renesas RA DFP](https://www2.renesas.eu/Keil_MDK_Packs/Renesas.RA_DFP.4.0.0.pack) which tend to use disjoint arrays quite frequently. Co-authored-by: n8tlarsen <[email protected]>
I'll leave this open until CI tests and register contents compare be implemented. |
I've run into an svd file where a set of registers is allocated linearly in memory, but only specific registers can be used. For example the span 0-31 is allocated for a register type, but only 0-3, 8, 9, 12, 14, 15 and 18 can be used. See ELSR* registers in R7FA2E1A9.svd from the Renesas RA DFP. When parsed by svd2rust version 0.25.1, this creates new types for each register grouping, often causing name collisions later when compiling the crate. I can see two ways to handle this:
I lean towards option two for the safety reasons, but am interested in other options for handling this use case.
The text was updated successfully, but these errors were encountered: