rp-rs / rp2040-pac

A Rust PAC for the RP2040 Microcontroller
145 stars 28 forks source link

update svdtools #61

Closed burrbull closed 1 year ago

9names commented 2 years ago

Switching from _derive to _copy does not work correctly with the other patches we make.

Specifically:

DMA:
  CH0_AL1_CTRL:
    _modify:
      "CHAIN_TO":
        description: "When this channel completes, it will trigger the channel indicated by CHAIN_TO. Disable by setting CHAIN_TO = _(this channel)_. \\n
        Reset value is 0, which means for channels 1 and above the default will be to chain to channel 0 - set this field to avoid this behaviour."
  CH0_AL2_CTRL:
    _modify:
      "CHAIN_TO":
        description: "When this channel completes, it will trigger the channel indicated by CHAIN_TO. Disable by setting CHAIN_TO = _(this channel)_. \\n
        Reset value is 0, which means for channels 1 and above the default will be to chain to channel 0 - set this field to avoid this behaviour."
  CH0_AL3_CTRL:
    _modify:
      "CHAIN_TO":
        description: "When this channel completes, it will trigger the channel indicated by CHAIN_TO. Disable by setting CHAIN_TO = _(this channel)_. \\n
        Reset value is 0, which means for channels 1 and above the default will be to chain to channel 0 - set this field to avoid this behaviour."

fails with

svdtools.patch.MissingRegisterError: Could not find DMA:CH0_AL1_CTRL

and

DMA:
  _cluster:
    "CH%s":
      "CH?_READ_ADDR,CH??_READ_ADDR": {}
      "CH?_WRITE_ADDR,CH??_WRITE_ADDR": {}
      "CH?_TRANS_COUNT,CH??_TRANS_COUNT": {}
      "CH?_CTRL_TRIG,CH??_CTRL_TRIG": {}
      "CH?_AL1_CTRL,CH??_AL1_CTRL": {}
      "CH?_AL1_READ_ADDR,CH??_AL1_READ_ADDR": {}
      "CH?_AL1_WRITE_ADDR,CH??_AL1_WRITE_ADDR": {}
      "CH?_AL1_TRANS_COUNT_TRIG,CH??_AL1_TRANS_COUNT_TRIG": {}
      "CH?_AL2_CTRL,CH??_AL2_CTRL": {}
      "CH?_AL2_TRANS_COUNT,CH??_AL2_TRANS_COUNT": {}
      "CH?_AL2_READ_ADDR,CH??_AL2_READ_ADDR": {}
      "CH?_AL2_WRITE_ADDR_TRIG,CH??_AL2_WRITE_ADDR_TRIG": {}
      "CH?_AL3_CTRL,CH??_AL3_CTRL": {}
      "CH?_AL3_WRITE_ADDR,CH??_AL3_WRITE_ADDR": {}
      "CH?_AL3_TRANS_COUNT,CH??_AL3_TRANS_COUNT": {}
      "CH?_AL3_READ_ADDR_TRIG,CH??_AL3_READ_ADDR_TRIG": {}

fails with

svdtools.patch.SvdPatchError: DMA: registers cannot be collected into CH%s cluster
burrbull commented 2 years ago

You have used _delete incorrect. Now both rust and python svdtools should work.

jannic commented 1 year ago

I tried to upgrade rp2040-hal to a pac generated with this pull request. But I got some problems regarding the ADC CS register, which has a bit START_ONCE which is annotated as <modifiedWriteValues>clear</modifiedWriteValues> in the svd file. I guess it's because the version of svd2rust used in this PR does not yet contain https://github.com/rust-embedded/svd2rust/pull/673

jannic commented 1 year ago

Clippy fails because the merge request doesn't yet contain updated, generated sources. I intentionally left them out to make the review easier. But I'll add them now, the commits are small enough to review them one by one if the changes to src/ are too confusing.

jannic commented 1 year ago

Updating src/ was a bad idea, as it causes merge conflicts. → undone Let's merge it first and then update the sources in a separate merge request.

ithinuel commented 1 year ago

Seems like @jannic feedbacks have been applied already. Merging.