CMSIS-SVD: Special Elements

| CMSIS-SVD Version 1.3.9 CMSIS System View Description

- Main Page
- Usage and Description

All Pages
Special Elements

This section describes elements that occur on various levels and specifies the general rules. Specific requirements are mentioned in the place where these elements occur.

- dimElementGroup - Elements that can be used to define arrays and lists in the code.
- registerPropertiesGroup - Register properties. Higher level definitions use as default values for lower level descriptions.

# dimElementGroup

The elements below appear on various levels and can be used to define arrays and lists in the code. Single descriptions get duplicated automatically into an array or a list. The subsequent is true for all elements of type dimableIdentifierType.

- To create arrays, use the placeholder [%s] at the end of a <name> and <displayName>. Do not define <dimIndex> in this case!
- To create lists, use the placeholder %s anywhere within or at the end of a <name> and <displayName>.

Note
  Some of the <name> and <displayName> elements can use both placeholders ([%s], %s), others just one. Refer to peripheral, register, cluster, and field for details.

Parent Element | Element Chain
--- | ---
peripheral | /device/peripherals/peripheral element
register | /device/peripherals/peripheral/registers/.../register element
cluster | /device/pripherals/peripheral/registers/.../cluster element
field | /device/peripherals/peripheral/registers/.../fields/field element
Grouped Elements | Description | Type | Occurrence
dim | Defines the number of elements in an array or list. | scaledNonNegativeInteger | 1..1
dimIncrement | Specify the address increment between two neighboring array or list members in the address map. | scaledNonNegativeInteger | 1..1
dimIndex | Specify the strings that substitue the placeholder %s within <name> and <displayName>. By default, <dimIndex> is a value starting with 0. Remark: Do not define <dimIndex> when using the placeholder [%s] in <name> or <displayName>. | dimIndexType | 0..1
dimName | Specify the name of the C-type structure. If not defined, then the entry in the <name> element is used. | identifierType | 0..1
dimArrayIndex | Grouping element to create enumerations in the header file. | dimArrayIndexType | 0..1

Example: The examples creates definitions for registers.

...
<register>
<dim>6</dim>
<dimIncrement>4</dimIncrement>
<dimIndex>A,B,C,D,E,Z</dimIndex>
<name>GPIO_%s_CTRL</name>
...
</register>

The code above generates the list: => GPIO_A_CTRL, GPIO_B_CTRL, GPIO_C_CTRL, GPIO_D_CTRL, GPIO_E_CTRL, GPIO_Z_CTRL

...
<register>
<dim>4</dim>
<dimIncrement>4</dimIncrement>
<dimIndex>3-6</dimIndex>
<name>IRQ%s</name>
...
</register>

The example above generates the list: => IRQ3, IRQ4, IRQ5, IRQ6

...
<register>
<dim>4</dim>
<dimIncrement>4</dimIncrement>
<name>MyArr[%s]</name>
...
</register>

The example above generates the array: => MyArr[4]

## /device/peripherals/peripheral/.../dimArrayIndex element

This information is used for generating an enum in the device header file. The debugger may use this information to display the identifier string as well as the description. Just like symbolic constants making source code more readable, the system view in the debugger becomes more instructive.

Example:

...
<dimArrayIndex>
<headerEnumName>FSMC_EnumArray</headerEnumName>
<enumeratedValue>
<name>UART0</name>
<description>UART0 Peripheral</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>TIMER0</name>
<description>TIMER0 Peripheral</description>
<value>1</value>
</enumeratedValue>
</dimArrayIndex>
...

/device/peripherals/peripheral/.../dimArrayIndex

Parent Element | Element Chain
--- | ---
peripheral | /device/peripherals/peripheral element
register | /device/peripherals/peripheral/registers/.../register element
cluster | /device/pripherals/peripheral/registers/.../cluster element
Child Elements | Description | Type | Occurrence
headerEnumName | Specify the base name of enumerations. Overwrites the hierarchical enumeration type in the device header file. User is responsible for uniqueness across description. The headerfile generator uses the name of a peripheral or cluster as the base name for enumeration types. If <headerEnumName> element is specfied, then this string is used. | identifierType | 0..1
enumeratedValue | Specify the values contained in the enumeration. | enumeratedValueType | 1..*

# registerPropertiesGroup

The following elements are available on various levels. Element values defined on a lower level overwrite element values defined on a more general level. For example, <register>.<size> overwrites <peripheral>.<size>. Elements not defined on a more general level, must be defined at <register> level at the latest.

Special requirements are described on the level where the element occurs. Click on the parent element in the table below for details.

Example:

<device schemaVersion="1.3" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd">
<name>ARM_Cortex_M3</name>
<version>0.1</version>
<description>Arm Cortex-M3 based Microcontroller demonstration device</description>
<addressUnitBits>8</addressUnitBits>
<width>32</width>
<size>32</size>
<access>read-write</access>
<protection>s</protection>
...
<peripherals>
...
</peripherals>
</device>

Default settings have been defined for <width>, <size>, <access>, and <protection> on device level. These settings can be refined on subsequent levels.

Register Properties

Parent Element | Element Chain
--- | ---
device | /device element
peripheral | /device/peripherals/peripheral element
register | /device/peripherals/peripheral/registers/.../register element
cluster | /device/pripherals/peripheral/registers/.../cluster element
| Below: Parent elements that have a reference to a single element of this block
field | /device/peripherals/peripheral/registers/.../fields/field element (only for element <access>)
sauRegionsConfig | /device/cpu/sauRegionsConfig element (element <protection> for attribute <protectionWhenDisabled>)
addressBlock | /device/peripherals/peripheral/addressBlock element (only for element <protection>)
Elements | Description | Type | Occurrence
size | Define the default bit-width of any device register (implicit inheritance). The value can be redefined on any lower level using the <size> element there. | scaledNonNegativeInteger | 0..1

access

Define access rights. Access rights can be redefined at any lower level. Use one of the following predefined values:

- read-only: Read access is permitted. Write operations have an undefined result.
- write-only: Read operations have an undefined result. Write access is permitted.
- read-write: Read and write accesses are permitted. Writes affect the state of the register and reads return the register value.
- writeOnce: Read operations have an undefined results. Only the first write after reset has an effect.
- read-writeOnce: Read access is always permitted. Only the first write access after a reset will have an effect on the content. Other write operations have an undefined result.

accessType

0..1

protection

Specify the security privilege to access an address region. This information is relevant for the programmer as well as the debugger when no universal access permissions have been granted. If no specific information is provided, an address region is accessible in any mode. The following values can be used to protect accesses by the programmer or debugger:

- "s" - secure permission required for access
- "n" - non-secure or secure permission required for access
- "p" - privileged permission required for access

protectionStringType

0..1

resetValue | Define the default value for all registers at RESET. The value can be redefined on any lower level using the <resetValue> element there. The actual reset value is calculated from the <resetValue> and the <resetMask>. The mask is used to specify bits with an undefined reset value. | scaledNonNegativeInteger | 0..1
resetMask | Identify register bits that have a defined reset value. These bit positions are set to 1. Bit positions with an undefined reset value are set to 0. | scaledNonNegativeInteger | 0..1