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

RemoveUselessEnums explodes with useless enum that has no 0 variant. #54

Open
i509VCB opened this issue Jan 21, 2025 · 0 comments
Open

Comments

@i509VCB
Copy link
Contributor

i509VCB commented Jan 21, 2025

From the MSPM0C110x SVD files, with the SYSCTL peripheral, the following enum causes a panic in !RemoveUselessEnums with the latest chiptool (57953f5)

Yes this enum is some internal testing or undefined register which TI left in their SVD files...

enum/FLBANK_SWAP:
  bit_size: 1
  variants:
  - name: YES
    description: System has a CSC.
    value: 1
  - name: NO
    description: No, system does not have a CSC.
    value: 2

I suspect the issue is that YES has a value of 1 and NO has a value of 2, which causes the transform to explode since there is no variant with a value of 0.

thread 'main' panicked at src/transform/delete_useless_enums.rs:76:69:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: core::option::unwrap_failed
   4: chiptool::transform::delete_useless_enums::DeleteUselessEnums::run
   5: chiptool::apply_transform
   6: chiptool::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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

1 participant