svdtools icon indicating copy to clipboard operation
svdtools copied to clipboard

Ability to uncluster

Open cosmikwolf opened this issue 1 year ago • 0 comments

With this vendor supplied SVD:

  <peripherals>
    <peripheral>
     <name>I2C0</name>
    < ... more attributes />
      <registers>
        <cluster>
          <dim>1</dim>
          <dimIncrement>0x18</dimIncrement>
          <dimArrayIndex/>
          <name>I2C0_GPRCM[%s]</name>
          <addressOffset>0x800</addressOffset>
          <register>
            <name>I2C0_PWREN</name>
           </register>
          ... more registers />
        </cluster>
      </registers>
    </peripheral>
  </peripherals>

I am unable to copy or rebase registers that are within the cluster, to the main peripheral:

I2C0:
  _copy:
    "PWREN":
      _from:
        "I2C0_GPRCM\\[%s\\]": "I2C0_PWREN"

I get the error:

fsh ❯ svdtools patch MSPM0G350X_patch.yml --enum-derive enum
[2024-09-24T22:04:26Z ERROR svdtools::cli] by svdtools (0.3.18)
    
    Caused by:
        0: Processing device `MSPM0G350X`
        1: According to `I2C0`
        2: Processing peripheral `I2C0`
        3: Copying register `PWREN` from `{String("_from"): Hash({String("I2C0_GPRCM\\[%s\\]"): String("I2C0_PWREN")})}`
        4: Under key `_from`
        5: Value is not a string: Hash({String("I2C0_GPRCM\\[%s\\]"): String("I2C0_PWREN")})

and with

I2C0:
  _rebase:
    _clusters:
      "I2C0_GPRCM\\[%s\\]":
        I2C0_PWREN: I2C0

i get the error:

fsh ❯ svdtools patch MSPM0G350X_patch.yml --enum-derive enum
[2024-09-24T22:05:08Z ERROR svdtools::cli] by svdtools (0.3.18)
    
    Caused by:
        0: Processing device `MSPM0G350X`
        1: According to `I2C0`
        2: Processing peripheral `I2C0`
        3: According to `_rebase`
        4: Could not find `I2C0:_rebase. Present registers: I2C0_CLKDIV, I2C0_CLKSEL, I2C0_PDBGCTL, I2C0_EVT_MODE, I2C0_INTCTL, I2C0_DESC, I2C0_GFCTL, I2C0_TIMEOUT_CTL, I2C0_TIMEOUT_CNT.`

I am also unable to copy clusters:

I2C0:
  _copy:
    "GPRCM":
      _from: "I2C0_GPRCM\\[%s\\]"

the original SVD file is linked in this other issue I recently submitted: https://github.com/rust-embedded/svdtools/issues/245

I think this is also related to https://github.com/rust-embedded/svdtools/issues/131

cosmikwolf avatar Sep 24 '24 22:09 cosmikwolf