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

Translating patched stm32f429.svd results in exception #10

Open
BostonBoston opened this issue Aug 18, 2024 · 3 comments · Fixed by #12
Open

Translating patched stm32f429.svd results in exception #10

BostonBoston opened this issue Aug 18, 2024 · 3 comments · Fixed by #12

Comments

@BostonBoston
Copy link

BostonBoston commented Aug 18, 2024

SVD file: https://github.com/tinygo-org/stm32-svd/blob/main/svd/stm32f429.svd
Output:

C:\Dev\svd2nim\build>svd2nim stm32f429.svd
C:\Dev\svd2nim\src\svd2nim.nim(110) svd2nim
C:\Dev\svd2nim\src\svd2nim.nim(86) main
C:\Dev\svd2nim\src\svd2nim.nim(34) processSvd
C:\Dev\svd2nim\src\svdparser.nim(319) readSVD
C:\Dev\svd2nim\src\svdparser.nim(287) parsePeripheral
C:\Dev\svd2nim\src\svdparser.nim(227) parseChildRegisters
C:\Dev\svd2nim\src\svdparser.nim(254) parseRegisterTreeNode
C:\Dev\svd2nim\src\svdparser.nim(209) parseField
C:\Dev\svd2nim\src\svdparser.nim(108) parseFieldEnum
Error: unhandled exception: Separate read/write enums not implemented [NotImplementedError]

This caused by field HSIRDY, which is a child of RCC.CR

<!--stm32f429.svd-->
<field>
	<name>HSIRDY</name>
	<description>Internal high-speed clock ready flag</description>
	<bitOffset>1</bitOffset>
	<bitWidth>1</bitWidth>
	<access>read-only</access>
	<enumeratedValues>
		<name>HSIRDYR</name>
		<usage>read</usage>
		<enumeratedValue>
			<name>NotReady</name>
			<description>Clock not ready</description>
			<value>0</value>
		</enumeratedValue>
		<enumeratedValue>
			<name>Ready</name>
			<description>Clock ready</description>
			<value>1</value>
		</enumeratedValue>
	</enumeratedValues>
</field>
@auxym
Copy link
Collaborator

auxym commented Aug 21, 2024

Here's a branch with a quick fix as we discussed on discord: https://github.com/EmbeddedNim/svd2nim/tree/ignore_multiple_enums

Seems not to crash. Try it out and let me know

@BostonBoston
Copy link
Author

Yes this did seem to do the trick for now.

@auxym
Copy link
Collaborator

auxym commented Aug 22, 2024

I merged the fix for the svd2nim crash, but re-opening this, because the Nim file generated by svd2nim for the stm32f429 SVD file does not compile. Running nim check on it produces the following output:

C:\Users\Francis\source\svd2nim\output_new\stm32f429.nim(440, 3) Error: attempt to redefine: 'BCR1'
C:\Users\Francis\source\svd2nim\output_new\stm32f429.nim(2061, 3) Error: attempt to redefine: 'DIEPTXF0'
C:\Users\Francis\source\svd2nim\output_new\stm32f429.nim(2340, 3) Error: attempt to redefine: 'DIEPCTL0'
C:\Users\Francis\source\svd2nim\output_new\stm32f429.nim(2355, 3) Error: attempt to redefine: 'DOEPCTL0'
C:\Users\Francis\source\svd2nim\output_new\stm32f429.nim(3217, 3) Error: attempt to redefine: 'DIEPCTL0'
C:\Users\Francis\source\svd2nim\output_new\stm32f429.nim(3219, 3) Error: attempt to redefine: 'DIEPTSIZ0'
C:\Users\Francis\source\svd2nim\output_new\stm32f429.nim(3244, 3) Error: attempt to redefine: 'DOEPCTL0'
C:\Users\Francis\source\svd2nim\output_new\stm32f429.nim(3246, 3) Error: attempt to redefine: 'DOEPTSIZ0'
C:\Users\Francis\source\svd2nim\output_new\stm32f429.nim(3831, 7) Error: field initialized twice: 'BCR1'
C:\Users\Francis\source\svd2nim\output_new\stm32f429.nim(3831, 7) Error: undeclared field: 'BCR1' for type stm32f429.FMC_Type [type declared in C:\Users\Francis\source\svd2nim\output_new\stm32f429.nim(435, 6)]
C:\Users\Francis\source\svd2nim\output_new\stm32f429.nim(3826, 22) Error: expression '' has no type (or is ambiguous)
C:\Users\Francis\source\svd2nim\output_new\stm32f429.nim(3826, 22) Error: illformed AST:

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

Successfully merging a pull request may close this issue.

2 participants