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

Error parsing svd file for MSPM0 #917

Closed
DanieleNardi opened this issue Feb 20, 2025 · 2 comments
Closed

Error parsing svd file for MSPM0 #917

DanieleNardi opened this issue Feb 20, 2025 · 2 comments

Comments

@DanieleNardi
Copy link

Running svd2rust on attached file I get the following error message:

[INFO  svd2rust] Parsing device from SVD file
[ERROR svd2rust] Error parsing SVD XML file

    Caused by:
        0: In device `MSPM0L130X`
        1: In peripheral `FLASHCTL`
        2: In register `FLASHCTL_STATMODE`
        3: Parsing field `BANKNOTINRD` at 5158:25
        4: `EnumeratedValue error: Value 2 out of range [0 - 1]

Executing same command with trace level log, I get the following:

[DEBUG svd2rust] Current svd2rust config: Config {
        target: CortexM,
        atomics: false,
        atomics_feature: None,
        generic_mod: false,
        make_mod: false,
        skip_crate_attributes: false,
        ignore_groups: false,
        keep_list: false,
        strict: false,
        feature_group: false,
        feature_peripheral: false,
        max_cluster_size: false,
        impl_debug: false,
        impl_debug_feature: None,
        impl_defmt: None,
        output_dir: None,
        input: Some(
            "MSPM0L130X.svd",
        ),
        source_type: Xml,
        log_level: Some(
            "trace",
        ),
        interrupt_link_section: None,
        reexport_core_peripherals: false,
        reexport_interrupt: false,
        ident_formats: IdentFormats(
            {
                "enum_write_name": IdentFormat {
                    case: Some(
                        Pascal,
                    ),
                    prefix: "",
                    suffix: "WO",
                },
                "cluster": IdentFormat {
                    case: Some(
                        Pascal,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "field_accessor": IdentFormat {
                    case: Some(
                        Snake,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "field_writer": IdentFormat {
                    case: Some(
                        Pascal,
                    ),
                    prefix: "",
                    suffix: "W",
                },
                "peripheral": IdentFormat {
                    case: Some(
                        Pascal,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "interrupt": IdentFormat {
                    case: None,
                    prefix: "",
                    suffix: "",
                },
                "enum_value": IdentFormat {
                    case: Some(
                        Pascal,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "cluster_accessor": IdentFormat {
                    case: Some(
                        Snake,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "register_mod": IdentFormat {
                    case: Some(
                        Snake,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "register_spec": IdentFormat {
                    case: Some(
                        Pascal,
                    ),
                    prefix: "",
                    suffix: "Spec",
                },
                "peripheral_singleton": IdentFormat {
                    case: Some(
                        Snake,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "register": IdentFormat {
                    case: Some(
                        Pascal,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "enum_value_accessor": IdentFormat {
                    case: Some(
                        Snake,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "cluster_mod": IdentFormat {
                    case: Some(
                        Snake,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "peripheral_feature": IdentFormat {
                    case: Some(
                        Snake,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "enum_read_name": IdentFormat {
                    case: Some(
                        Pascal,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "register_accessor": IdentFormat {
                    case: Some(
                        Snake,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "enum_name": IdentFormat {
                    case: Some(
                        Pascal,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "peripheral_mod": IdentFormat {
                    case: Some(
                        Snake,
                    ),
                    prefix: "",
                    suffix: "",
                },
                "field_reader": IdentFormat {
                    case: Some(
                        Pascal,
                    ),
                    prefix: "",
                    suffix: "R",
                },
            },
        ),
        ident_formats_theme: None,
        field_names_for_enums: true,
        base_address_shift: 0,
        settings_file: None,
        settings: Settings {
            html_url: None,
            crate_path: None,
            riscv_config: None,
        },
    }
[INFO  svd2rust] Parsing device from SVD file
[ERROR svd2rust] Error parsing SVD XML file

    Caused by:
        0: In device `MSPM0L130X`
        1: In peripheral `FLASHCTL`
        2: In register `FLASHCTL_STATMODE`
        3: Parsing field `BANKNOTINRD` at 5158:25
        4: `EnumeratedValue error: Value 2 out of range [0 - 1]

MSPM0L130X.zip

@burrbull
Copy link
Member

Fix BANKNOTINRD bitWidth

@burrbull
Copy link
Member

burrbull commented Feb 20, 2025

PS. There are also several syntax bugs in this file:

access: read-writeonce -> read-writeOnce

dimArrayIndex -> dimIndex

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

2 participants