-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix gd32e1 #40
Fix gd32e1 #40
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
_include: | ||
- "adc_common.yaml" | ||
- "eteic.yaml" | ||
- "swrcst.yaml" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright 2023 The gd32-rs authors. | ||
# | ||
# SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
_include: | ||
- "adc_common.yaml" | ||
- "eteic.yaml" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ _include: | |
- "adc_common.yaml" | ||
- "adc_high_f2_f3.yaml" | ||
- "eteic.yaml" | ||
- "swrcst.yaml" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
_include: | ||
- "adc_common.yaml" | ||
- "adc_high_f2_f3.yaml" | ||
- "swrcst.yaml" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright 2023 The gd32-rs authors. | ||
# | ||
# SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
ADC*: | ||
CTL1: | ||
SWRCST: | ||
_read: | ||
Started: [0, "Reset state"] | ||
NotStarted: [1, "Starting conversion of regular channels"] | ||
_write: | ||
Start: [1, "Start conversion of regular channels"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
# Common features found on all timers. | ||
|
||
TIMER0: | ||
"TIMER*": | ||
CTL0: | ||
ARSE: | ||
Disabled: [0, "The shadow register for CAR is disabled"] | ||
|
@@ -34,27 +34,5 @@ TIMER0: | |
SWEVG: | ||
UPG: | ||
Update: [1, "Re-initializes the timer counter and generates an update of the registers."] | ||
|
||
"TIMER[1-9],TIMER1[0-9]": | ||
CTL0: | ||
ARSE: | ||
_derivedFrom: "TIMER0.CTL0.ARSE.ARSE" | ||
UPS: | ||
_derivedFrom: "TIMER0.CTL0.UPS.UPS" | ||
UPDIS: | ||
_derivedFrom: "TIMER0.CTL0.UPDIS.UPDIS" | ||
CEN: | ||
_derivedFrom: "TIMER0.CTL0.CEN.CEN" | ||
DMAINTEN: | ||
UPIE: | ||
_derivedFrom: "TIMER0.DMAINTEN.UPIE.UPIE" | ||
INTF: | ||
UPIF: | ||
_derivedFrom: "TIMER0.INTF.UPIF.UPIF" | ||
SWEVG: | ||
UPG: | ||
_derivedFrom: "TIMER0.SWEVG.UPG.UPG" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't removing all these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The codegen gave the same types for the identical timers (timer1/2/3/4 for instance), but the type itself is different between different timers indeed :/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's going to be a problem then, please keep the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get issues when I try to use the derived peripherals:
If I try to use cen here for instance I get:
The read is working though ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried compiling the gd32f1x0-hal library on this repo's main branch and I got the same error 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I guess I'm going to need to bisect then. I probably won't have time for a few days though. If you figure out what's going on in the meantime let me know. If it would be helpful I'm happy to merge everything except for the timer changes for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is a change that happened with the new svd2rust. During code generation the enum type and reader type are just linked to the original one, but the writer is put as a new type. The issue is either that the writer is defined as a new type or that the writer doesn't have any implementation (it should have the methods to set the register values). I'm trying to look in svd2rust's code to understand how this happened. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Found it, it appears to be a bug in svd2rust. This crate in v0.6.0 was using svd2rust 0.24.0 (which have been yanked from the registry), and the bug appeared in svd2rust 0.25.0. |
||
|
||
"TIMER*": | ||
PSC: | ||
PSC: [0, 0xFFFF] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the advantage of this over giving a range like we had before? It's marginally longer, and I find the range easier to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I read in svdtools, ranges are not supported. This means it was trying to match "TIMER13", "TIMER1-" and "TIMER16" before :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? It seemed to be working fine before, and the stm32-rs repository is using it, e.g. in https://github.com/stm32-rs/stm32-rs/blob/master/peripherals/tim/tim_basic.yaml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it uses this svdtools I don't see any way to use ranges. The parsing code doesn't seem to handle it (https://github.com/stm32-rs/svdtools/blob/074c31f67938ae21efeb2c74fe01260d7e4f55ff/src/patch/mod.rs#L486) and the documentation has a very small set of tokens (https://github.com/stm32-rs/svdtools#name-matching).
It was not working when I was using it, e.g.
TIM[1-58]
was matching TIM1, TIM5 and TIM8 (so was not reporting an error not finding TIM- because it only needs one match to work), but not TIM2There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're using the Python version of svdtools still, so maybe it has more functionality? It does look like there is a bug here though, so I'll have a proper look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried building locally, and I get exactly the same output in the
svd/*.svd.patched
files with or without your change to stop using ranges, so I'm pretty sure thesvd patch
is handling them properly as expected. Removing my_derivedFrom
fixes does change the output, so we don't want to change that.I'm not sure why it's not working for you. How are you trying to build it, just using
make
? What version ofsvdtools
do you have installed, and did you install frompip
or somewhere else?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh, I was using the rust version. The python version uses braceexpand/fnmatch which handles these kind of things. I'll fix that on my machine and try to rollback the other ones I had unrolled in previous versions too then :)