CMSIS-SVD: Extensions to the Register Section

| CMSIS-SVD Version 1.3.1 CMSIS System View Description

- Main Page
- Usage and Description
- Reference

Extensions to the Register Section
SVD Extensions

The following elements have been added to the register section. All new elements are optional.

Element Name | Description | Type | Occurrence
--- | --- | --- | ---
alternateRegister | This tag can reference a register that has been defined above to current location in the description and that describes the memory location already. This tells the SVDConv's address checker that the redefinition of this particular register is intentional. The register name needs to be unique within the scope of the current peripheral. A register description is defined either for a unique address location or could be a redefinition of an already described address. In the latter case, the register can be either marked alternateRegister and needs to have a unique name, or it can have the same register name but is assigned to a register subgroup through the tag alternateGroup (specified in version 1.0). | identifierType | 0..1
dataType | It can be useful to assign a specific native C datatype to a register. This helps avoiding type casts. For example, if a 32 bit register shall act as a pointer to a 32 bit unsigned data item, then dataType can be set to "uint32_t *". The following simple data types are predefined: uint8_t: unsigned byte uint16_t: unsigned half word uint32_t: unsigned word uint64_t: unsigned double word int8_t: signed byte int16_t: signed half word int32_t: signed world int64_t: signed double word uint8_t *: pointer to unsigned byte uint16_t *: pointer to unsigned half word uint32_t *: pointer to unsigned word uint64_t *: pointer to unsigned double word int8_t *: pointer to signed byte int16_t *: pointer to signed half word int32_t *: pointer to signed world int64_t *: pointer to signed double word | dataTypeType | 0..1

# Example:

...
<register>
<name>TIM_MODEA</name>
<description>In mode A this register acts as a reload value</description>
<addressOffset>0xC</addressOffset>
</register>
<register>
<name>TIM_MODEB</name>
<description>In mode B this register acts as the compare value</description>
<alternateRegister>TIM_MODEA</alternateRegister>
<addressOffset>0xC</addressOffset>
</register>
<register>
<name>DMA_DATA</name>
<description>This register contains the address of the data being transferred</description>
<dataType>uint32_t *</dataType>
<addressOffset>0xf0</addressOffset>
</register>
...

This example describes two registers, TIM_MODEA and TIM_MODEB. Both have the same address offset. Based on the configured operation model being A or B, the register acts as reload or compare value. The register DMA_DATA is specified as a pointer to unsigned word data. The code generated for the device header file is:

typedef struct {
union {
__IO uint32_t TIM_MODEA;
__IO uint32_t TIM_MODEB;
};
__IO uint32_t * DMA_DATA;
...
} <peripheral:name>_Type;