embassy-rs / embassy-rs/chiptool
Enums with `isDefault` not handled correctly
- Dominant language
- Rust
- Stars
- 65
- Forks
- 54
- PR merge metrics
- No merged PRs in 30d
Description
In the Renesas RA SVDs, there are some [enums](https://arm-software.github.io/CMSIS_5/SVD/html/elem_registers.html#elem_enumeratedValues) like the below, with `isDefault` and no `value`.
```xml
MOSEL
Main Clock Oscillator Switching
6
7
read-write
01
Resonator
#01
11
External clock input mode
#11
Others
Port mode
true
```
This causes `chiptool` to crash at https://github.com/embassy-rs/chiptool/blob/26983da961307008dee1ef6b85c93a9489c8ae94/src/svd2ir.rs#L308
while `svd2rust` generates the following enum:
```rust
#[doc = "Main Clock Oscillator Switching\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Mosel {
#[doc = "1: Resonator"]
_01 = 1,
#[doc = "3: External clock input mode"]
_11 = 3,
#[doc = "0: Port mode"]
Others = 0,
}
```
Related issues in `svd2rust`:
- https://github.com/rust-embedded/svd2rust/issues/172
- https://github.com/rust-embedded/svd2rust/issues/852
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.