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

Changing bit width of SAML11 DAUTHSTATUS.NSID and .NSNID fields to 2 #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rubikstoroid
Copy link

I noticed while trying to run svd2rust on one of the ATSAML11 SVD files that the operation failed with the following message:

[INFO  svd2rust] Parsing device from SVD file
[ERROR svd2rust] Error parsing SVD XML file
    
    Caused by:
        0: In device `ATSAML11E14A`
        1: In peripheral `DIB`
        2: In register `DAUTHSTATUS`
        3: Parsing field `NSID` at 19898:19
        4: `EnumeratedValue error: Value 2 out of range 0..2

All 6 of the ATSAML11 SVD files appear to have an issue with the NSID and NSNID fields of the DAUTHSTATUS register, in that they set enumerated values of 2 and 3 for a field that is stated to be only 1 bit wide.

I looked at core_cm23.h and that file confirms that these fields should actually be 2 bits wide:

#define DIB_DAUTHSTATUS_NSNID_Pos           2U                                            /*!< DIB DAUTHSTATUS: Non-secure Non-invasive Debug Position */
#define DIB_DAUTHSTATUS_NSNID_Msk          (0x3UL << DIB_DAUTHSTATUS_NSNID_Pos )          /*!< DIB DAUTHSTATUS: Non-secure Non-invasive Debug Mask */

#define DIB_DAUTHSTATUS_NSID_Pos            0U                                            /*!< DIB DAUTHSTATUS: Non-secure Invasive Debug Position */
#define DIB_DAUTHSTATUS_NSID_Msk           (0x3UL /*<< DIB_DAUTHSTATUS_NSID_Pos*/)        /*!< DIB DAUTHSTATUS: Non-secure Invasive Debug Mask */

I fixed the issue in these fields and svd2rust runs successfully now. I haven't attempted to determine whether a similar issue may exist elsewhere.

@rubikstoroid rubikstoroid changed the title Changing bit width of SAML11 DAUTHSTATUS.NSID and .NSNID registers to 2 Changing bit width of SAML11 DAUTHSTATUS.NSID and .NSNID fields to 2 Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant