Comments (6)
This looks like a bug in the schema. The enumeratedValue
minOccurs should be 0, even if this only true in case the derivedFrom
attribute is specified.
from cmsis_5.
If I understand correctly, XSD does not allow us to specify the relationship between the presence of the derivedFrom
attribute and the number of enumeratedValue
elements.
Do I understand correctly that if the derivedFrom
attribute is missing, then the number of enumeratedValue
elements should be at least one?
from cmsis_5.
[..] XSD does not allow us to specify the relationship [..]
No, not directly. What might work is grouping elements into exclusive groups. But that easily creates new issues/drawbacks.
The schema describes the syntax of a language. The relationship between elements is about semantics.
from cmsis_5.
@JonatanAntoni
Could you give an example of how this can be done?
from cmsis_5.
It looks like the feature of reusing enumerated values has not really been used, as it would fail with the current schema. Sorry for the inconvenience.
Here is an example of how deriving an enumeratedValues description in a separate field.
I am using the ARM_Example.svd included in the ARM.CMSIS.5.9.0.pack in the CMSIS/utilities/ directory.
I am reusing the enumeration of the field "EN". To reference the enumeratedValues section, I need to specify the optional name tag in line 115
<enumeratedValues>
<name>EN_enum</name>
For demonstration purposes I am adding a new register description:
<register>
<name>InheritEnum</name>
<description>Control Register</description>
<addressOffset>0xF0</addressOffset>
<size>32</size>
<access>read-write</access>
<resetValue>0x00000000</resetValue>
<resetMask>0xFFFFFFFF</resetMask>
<fields>
<field>
<name>EN</name>
<description>Enable</description>
<bitRange>[0:0]</bitRange>
<access>read-write</access>
<enumeratedValues derivedFrom="TIMER0.CR.EN.EN_enum"/>
</field>
</fields>
</register>
In the above case it would have been smarter to derive the field EN
.
The converter happily converts the above, however the schema requires changes to pass:
a) the derivedFrom
attribute does not support dots .
which are required for referencing a peripheral.register.field.enum
. A new type shall be added to the schema e.g. referenceIdentifierType
b) as suggested above in the enumerationType
the attribute minOccurs=0
nees to be set for the enumeratedValue
element.
As a consequence the schema check no longer detects the case where the element enumeratedValues
which is not derivedFrom
another named enumeratedValues
description, does not contain any enumeratedValue
child elements.
Note that most people are generating the SVD file from some other source and therefore do not make use of deriving field and enumeration descriptions. I would be interested to understand how your use case is different.
from cmsis_5.
Note that most people are generating the SVD file from some other source and therefore do not make use of deriving field and enumeration descriptions. I would be interested to understand how your use case is different.
I'm taking SVD from the project https://github.com/stm32-rs/stm32-rs (more specifically https://stm32-rs.github.io/stm32-rs/) in order to use it in https://marketplace.visualstudio.com/items?itemName=mcu-debug.peripheral-viewer.
Sometimes I open SVD in VS Code editor to view and make changes.
In VS Code I use the extension https://marketplace.visualstudio.com/items?itemName=redhat.vscode-xml.
This extension performs XSD validation, as a result of which many errors are detected (see the very first message).
from cmsis_5.
Related Issues (20)
- Possible bugs in `__STREXW` and `__LDREXW` in cmsis_armcc.h and cmsis_armclang.h HOT 5
- SVD multiple enumeratedValues occurrences meaning HOT 2
- Filter State variable access with Python Wrapper for arm_biquad_casd_df1_inst_f32 HOT 1
- Issues with new ARMv8 MPU attributes HOT 1
- Issue with osDelay in TC_osKernelResume_1 HOT 2
- RTX4 EXCLUSIVE_ACCESS macro undefined for GCC compiler HOT 2
- Versioning of CMSIS Core missmatch HOT 3
- Add HOST support HOT 2
- Output Mismatch in ARM mult , scale, Complex real mult in CMSIS 5.9 version HOT 1
- `CMSIS_DEPRECATED` for Cortex M? HOT 1
- Error in the description of CMSIS-SVD HOT 1
- EMAC_iMXRT1064.c file is not compatible with fsl_enet driver in Keil HOT 3
- [SVDConv] `writeConstraint` in `register` crashes SVDConv HOT 2
- How to build a library in the Ti env. HOT 1
- Thread switch on osKernelRestoreLock? HOT 2
- RTOS2 - memory block pools vs byte pools? HOT 7
- armv8-m register define doesn't include BPU HOT 2
- Extension of osKernelGetTickCount() to provide monotonic tick counter is in error. HOT 3
- Git LFS Data Limit Exceeded HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cmsis_5.