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

Arrays are not always expanded resulting in invalid subtype declarations. #106

Open
rowsail opened this issue Sep 1, 2024 · 0 comments
Open

Comments

@rowsail
Copy link

rowsail commented Sep 1, 2024

Running svd2ada on (for example) https://github.com/espressif/svd/blob/main/svd/esp32s3.svd does not always handle arrays correctly.

Taking the excerpt:

<register>
          <name>INT_RAW</name>
          <description>Raw interrupt status</description>
          <addressOffset>0x70</addressOffset>
          <size>0x20</size>
          <fields>
            <field>
              <dim>4</dim>
              <dimIncrement>0x1</dimIncrement>
              <dimIndex>0-3</dimIndex>
              <name>CH%s_TX_END</name>
              <description>The interrupt raw bit for CHANNEL%s. Triggered when transmission done.</description>
              <bitOffset>0</bitOffset>
              <bitWidth>1</bitWidth>
              <access>read-write</access>
            </field>
            <field>
              <dim>4</dim>
              <dimIncrement>0x1</dimIncrement>
              <dimIndex>0-3</dimIndex>
              <name>CH%s_TX_ERR</name>
              <description>The interrupt raw bit for CHANNEL%s. Triggered when error occurs.</description>
              <bitOffset>4</bitOffset>
              <bitWidth>1</bitWidth>
              <access>read-write</access>
            </field>

Will create:

subtype INT_RAW_CH%s_TX_END_Field is ESP32-S3.Bit;
  subtype INT_RAW_CH%s_TX_ERR_Field is ESP32-S3.Bit;
  subtype INT_RAW_CH%s_TX_THR_EVENT_Field is ESP32-S3.Bit;
  subtype INT_RAW_CH%s_TX_LOOP_Field is ESP32-S3.Bit;
  subtype INT_RAW_CH%s_RX_END_Field is ESP32-S3.Bit;
  subtype INT_RAW_CH%s_RX_ERR_Field is ESP32-S3.Bit;
  subtype INT_RAW_CH%s_RX_THR_EVENT_Field is ESP32-S3.Bit;
  subtype INT_RAW_TX_CH3_DMA_ACCESS_FAIL_Field is ESP32-S3.Bit;
  subtype INT_RAW_RX_CH7_DMA_ACCESS_FAIL_Field is ESP32-S3.Bit;

--  Raw interrupt status
  type INT_RAW_Register is record
     --  The interrupt raw bit for CHANNEL%s. Triggered when transmission
     --  done.
     CH%s_TX_END            : INT_RAW_CH%s_TX_END_Field := 16#0#;
     --  unspecified
     Reserved_1_3           : ESP32-S3.UInt3 := 16#0#;
     --  The interrupt raw bit for CHANNEL%s. Triggered when error occurs.
     CH%s_TX_ERR            : INT_RAW_CH%s_TX_ERR_Field := 16#0#;
     --  unspecified
     Reserved_5_7           : ESP32-S3.UInt3 := 16#0#;
     --  The interrupt raw bit for CHANNEL%s. Triggered when transmitter sent
     --  more data than configured value.
     CH%s_TX_THR_EVENT      : INT_RAW_CH%s_TX_THR_EVENT_Field := 16#0#;
     --  unspecified
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