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

svd2ada doesn't support dimElementGroup in peripheral tags (peripheralType) #100

Open
luzidchris opened this issue Dec 26, 2022 · 0 comments

Comments

@luzidchris
Copy link

SVD schema 1.3.1 allows use of tags to define arrays/lists of peripheralType. The schema is used by svd2ada but the current implementation raises CONSTRAINT_ERROR because it doesn't recognize the dim-related tags when they appear in a peripheralType.

<xs:complexType name="peripheralType">
    <xs:sequence>
      <!-- 1.3: specify uni-dimensional array of peripheral - requires name="<name>[%s]" -->
      <xs:group    ref="dimElementGroup" minOccurs="0"/>
      <!-- name specifies the name of a peripheral. This name is used for the System View and device header file -->

dimElementGroup contains tags defining the kind of list of peripherals based on the peripheral containing the dim-tag, pretty much like it's done for registers, too.

  <!-- dimElementGroup specifies the number of array elements (dim), the address offset
       between to consecutive array elements and an a comma seperated list of strings
       being used for identifying each element in the array -->
  <xs:group name="dimElementGroup">
    <xs:sequence>
      <xs:element name="dim" type="scaledNonNegativeInteger"/>
      <xs:element name="dimIncrement" type="scaledNonNegativeInteger"/>
      <xs:element name="dimIndex" type="dimIndexType" minOccurs="0"/>
    </xs:sequence>
  </xs:group>

My assumption is that svd2ada implements the schema which is located in directory schema of this project, but this might be wrong, so I'm sorry in case I've missed something!

Support of dimElementGroup for peripheralType would reduce SVD size and complexity, and thus the resulting code, at least in case a device realizes multiple instances of an individual periphery. Using arrays could also simplify the driver implementation.

A similar effect could be achieved by use of clusters. I guess this therefore is not a major blocker... But once there's a more complex SVD which makes use of this feaure, it would be necessary to modify the file to work around this issue.

If there were plans to realize this in svd2ada, it might be worth considering an update to SVD version 1.3.9 which additionally supports dimArrayIndex in dimElementGroup. This is pretty useful when it comes to symbolic access of array elements (applicable to all tags supporting dimElementGroup, not only periphalType). Further information on this can be found here: https://www.keil.com/pack/doc/CMSIS/SVD/html/elem_special.html#elem_dimArrayIndex

This was referenced Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant