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

derivedFrom for field enumerations produces error #84

Open
c-grant opened this issue Apr 27, 2021 · 1 comment
Open

derivedFrom for field enumerations produces error #84

c-grant opened this issue Apr 27, 2021 · 1 comment

Comments

@c-grant
Copy link

c-grant commented Apr 27, 2021

When trying to use the derivedFrom attribute on an enumeration an error is thrown

svd2ada --boolean --gen-uint-always --no-vfa-on-types --gen-uint-always -o STM32 -p STM32_SVD STM32F439x.svd
raised CONSTRAINT_ERROR : enumerate 'derivedFrom' is not known: MODER15.MODEREnumVals

svd2ada --boolean --gen-uint-always --no-vfa-on-types --gen-uint-always -o STM32 -p STM32_SVD STM32F439x.svd
raised CONSTRAINT_ERROR : enumerate 'derivedFrom' is not known: MODER.MODER15.MODEREnumVals

svd2ada --boolean --gen-uint-always --no-vfa-on-types --gen-uint-always -o STM32 -p STM32_SVD STM32F439x.svd
raised CONSTRAINT_ERROR : enumerate 'derivedFrom' is not known: GPIOK.MODER.MODER15.MODEREnumVals

svd2ada --boolean --gen-uint-always --no-vfa-on-types --gen-uint-always -o STM32 -p STM32_SVD STM32F439x.svd
raised CONSTRAINT_ERROR : enumerate 'derivedFrom' is not known: MODEREnumVals

an example derivedFrom attribute for the last error the is as follows

<enumeratedValues derivedFrom="MODEREnumVals">

example enumerated value

<enumeratedValues> <name>MODEREnumVals</name> <enumeratedValue> <name>Input</name> <description>Input (reset state)</description> <value>0</value> </enumeratedValue> <enumeratedValue> <name>GP_Output_Mode</name> <description>General purpose output mode</description> <value>1</value> </enumeratedValue> <enumeratedValue> <name>Alternate_Function_Mode</name> <description>Alternate function mode</description> <value>2</value> </enumeratedValue> <enumeratedValue> <name>Analog_Mode</name> <description>Analog mode</description> <value>3</value> </enumeratedValue> </enumeratedValues>

@luzidchris
Copy link

Might be little bit late to reply but I've experienced a similar issue. svd2ada doesn't gather enumerationValue tags evaluating them. If the the tag referenced by derivedFrom hasn't been evaluated yet, it won't be found and a CONSTRAINT_ERROR is thrown.
I assume fixing this requires some refactoring, though it should be at least possible to work around this by modifying the svd file accordingly, i.e., you need to ensure that tags referenced by derivedFrom appear first before the corresponding tag.

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

2 participants