-
Notifications
You must be signed in to change notification settings - Fork 38
Description
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