SVD with faulty field access values cannot be loaded by the Rust version of svdtools patch
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start with the failing access parsing in svd-parser/src/field.rs and its caller in svdtools/src/patch/mod.rs. Reproduce the error using the GD32F30x_XD.svd file and the YAML rules shown in the issue. Done means the Rust version has a documented or implemented path for handling the faulty access values while preserving valid SVD parsing behavior.
Written by the indexing model from the issue text.
Description
Hi,
I am using the Python version of svdtools to patch some GigaDevice GD32F303 SVD files.
In these files, the SVD does not even comply with CMSIS-SVD.xsd because I have some fields with read or write access:
<field>
<name>IRC48MSTBIC</name>
<description>Internal 48 MHz RC oscillator Stabilization Interrupt Clear</description>
<bitOffset>22</bitOffset>
<bitWidth>1</bitWidth>
<access>write</access>
</field>
In the YAML, I have some rules to change this:
_svd: ../svd/gd32f303.svd
RCU:
ADDINT:
_modify:
IRC48MSTBIC:
access: write-only
RTC:
PSC[LH]:
_modify:
PSC:
access: write-only
_modify:
DIV[LH]:
access: read-only
ALRM[LH]:
access: write-only
USART0:
STAT1:
_modify:
EBF:
access: write-only
RTF:
access: write-only
I have tried the Rust version of svdtools to see the difference but I cannot even run it, I have this error:
$ svdtools patch devices/gd32f303.yaml svd/gd32f303.svd.patched.rust
[2025-05-29T13:39:58Z ERROR svdtools::cli] by svdtools (0.5.0)
Caused by:
0: In device `GD32F30x_XD`
1: In peripheral `RCU`
2: In register `ADDINT`
3: In field `IRC48MSTBIC`
4: Parsing unknown access at 25442:15
5: unknown access variant 'write' found
I have ran a debugger on it and this is this line of svd-parser that fails: https://github.com/rust-embedded/svd/blob/60a3b6019a4375e683e9bc3ffbe9ad6aeebb6828/svd-parser/src/field.rs#L32 called from this line in svdtools: https://github.com/rust-embedded/svdtools/blob/6ebab74e99f7241536de4f10d16cb48eb1b2d709/src/patch/mod.rs#L134
I understand that svd-parser should only load valid SVD file.
But svdtools is made to fix buggy SVD files but cannot be used on a SVD file not following the spec.
For now, I can keep using the more permissive Python version. But I wanted to let you know of this issue.
I can also do a two-step process with a first pass with the Python version and only the YAML provided above and then a second pass with the Rust version on the Python patched SVD :)
One of the faulty SVD for reference: https://github.com/gd32-rust/gd32-rs/blob/2e4796265091558e922c5d69d0a31ffd641548b2/svd/vendor/GD32F30x_XD.svd
- Dominant language
- Rust
- Stars
- 123
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-embedded/svdtools
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
rust-embedded/svdtools#294 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
rust-embedded/svdtools#293 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 32/100
rust-embedded/svdtools#284 · 9 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
rust-embedded/svdtools#282 · 2 comments ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 25/100
rust-embedded/svdtools#277 ·
All issues in rust-embedded/svdtools
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100