Skip to content

Incorrect code from invalid SVD file #94

@wt

Description

@wt

I have been working with LPC55S16. You can find the version of the SVD I am look at here.

If you search the SVD for "SECCHANNEL", you will find a cluster with three registers in it. The addressOffset of the cluster is 0 and the dimIncrement is 0x20. It has three contained registers with addressOffsets of 0xc20, 0xc24, and 0xc28 defined as children.

0xc20 as an offset makes that register fall outside of size the first entry of the array.

The fix for the SVD is to make the offsets correct. The cluster itself should have an offset of 0xc20, and the registers should have offsets of 0, 0x4, and 0x8.

Chiptool will gladly generate incorrect code for the SVD before the fix. Svd2rust bombs out. I think the right thing would be to produce an error when the cluster size exceeds the dimIncrement size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions