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

collect in cluster/array descriptions #178

Merged
merged 4 commits into from
Nov 28, 2023
Merged

collect in cluster/array descriptions #178

merged 4 commits into from
Nov 28, 2023

Conversation

burrbull
Copy link
Member

@burrbull burrbull commented Oct 30, 2023

replaces #177
cc @kossnikita

@burrbull burrbull force-pushed the desc branch 2 times, most recently from d1aaca8 to 20f62cd Compare October 30, 2023 15:53
@burrbull burrbull marked this pull request as ready for review October 30, 2023 15:53
Copy link
Contributor

@kossnikita kossnikita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fail with

_svd: stm32l4x2.svd
LCD:
  RAM_COM6:
    _array:
      S?? : {}
RAM_COM6: fields cannot be collected into S?? array. Please, specify description

src/patch/mod.rs Outdated Show resolved Hide resolved
@burrbull
Copy link
Member Author

burrbull commented Nov 5, 2023

cc @Emilgardis

@kossnikita
Copy link
Contributor

What about #178 (review)?
I don't like that this breaks existing patches that previously worked correctly

@burrbull
Copy link
Member Author

burrbull commented Nov 5, 2023

What about #178 (review)? I don't like that this breaks existing patches that previously worked correctly

Sorry missed this comment.
Can't reproduce. Is it stm32-rs repo? Could you retry on last stm32-rs master and this PR?

@burrbull
Copy link
Member Author

burrbull commented Nov 5, 2023

Saying about "RAM_COMx". It looks like there are missed high parts of "64-bit" registers.

@kossnikita
Copy link
Contributor

kossnikita commented Nov 5, 2023

Is it stm32-rs repo?

This is
svdtools/example/stm32l4x2.svd
My example about auto collecting discriptions like S??. Before PR this works.

@burrbull
Copy link
Member Author

burrbull commented Nov 8, 2023

Is it stm32-rs repo?

This is svdtools/example/stm32l4x2.svd My example about auto collecting discriptions like S??. Before PR this works.

Thanks. I totally forgot about this example.
I think this is one of special cases where we need to specify description manually. (or maybe even collect should not work at all).
The issue is names of these fields. They are looks like numerical (and can be parsed as numerical) but instead of S0, S1, S2, .., S31 they are S01, S02, S03, .., S31. So before this patch result looks like (both description and dimIndex are incorrect):

        <register>
          <name>RAM_COM6</name>
          <displayName>RAM_COM6</displayName>
          <description>display memory</description>
          <addressOffset>0x44</addressOffset>
          <size>0x20</size>
          <access>read-write</access>
          <resetValue>0x00000000</resetValue>
          <fields>
            <field>
              <dim>32</dim>
              <dimIncrement>0x1</dimIncrement>
              <dimIndex>0-31</dimIndex>
              <name>S%s</name>
              <description>S00</description>
              <bitOffset>0</bitOffset>
              <bitWidth>1</bitWidth>
            </field>
          </fields>
        </register>

After patch it fails on descriptions.
But real issue is it should produce <dimIndex>00,01,02,..,31</dimIndex> instead of <dimIndex>0-31</dimIndex>.

UPD. After last commit it produces:

        <register>
          <name>RAM_COM6</name>
          <displayName>RAM_COM6</displayName>
          <description>display memory</description>
          <addressOffset>0x44</addressOffset>
          <size>0x20</size>
          <access>read-write</access>
          <resetValue>0x00000000</resetValue>
          <fields>
            <field>
              <dim>32</dim>
              <dimIncrement>0x1</dimIncrement>
              <dimIndex>0-31</dimIndex>
              <name>S%s</name>
              <description>S%s</description>
              <bitOffset>0</bitOffset>
              <bitWidth>1</bitWidth>
            </field>
          </fields>
        </register>

but there is still issue with dimIndex which is somewhere in svd-rs or svd-encode.

@kossnikita
Copy link
Contributor

Looks good now

<field>
  <dim>32</dim>
  <dimIncrement>0x1</dimIncrement>
  <dimIndex>00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31</dimIndex>
  <name>S%s</name>
  <description>S%s</description>
  <bitOffset>0</bitOffset>
  <bitWidth>1</bitWidth>
</field>

@kossnikita
Copy link
Contributor

kossnikita commented Nov 15, 2023

I have problem with this but I don't understand the problem
Without collecting DT10 works good

  _array:
    DT?,DT[1][0]:
      description: Battery powered domain data register %s
    DT??:
      description: Battery powered domain data register %s
<registers>
    <register>
      <name>DT1</name>
      <displayName>DT1</displayName>
      <description>Battery powered domain data
      register (BPR_DTx)</description>
    </register>
    <register>
      <name>DT2</name>
      <displayName>DT2</displayName>
      <description>Battery powered domain data
      register (BPR_DTx)</description>
    </register>
    <register>
      <name>DT3</name>
      <displayName>DT3</displayName>
      <description>Battery powered domain data
      register (BPR_DTx)</description>
    </register>
    <register>
      <name>DT4</name>
      <displayName>DT4</displayName>
      <description>Battery powered domain data
      register (BPR_DTx)</description>
    </register>
    <register>
      <name>DT5</name>
      <displayName>DT5</displayName>
      <description>Battery powered domain data
      register (BPR_DTx)</description>
    </register>
    <register>
      <name>DT6</name>
      <displayName>DT6</displayName>
      <description>Battery powered domain data
      register (BPR_DTx)</description>
    </register>
    <register>
      <name>DT7</name>
      <displayName>DT7</displayName>
      <description>Battery powered domain data
      register (BPR_DTx)</description>
    </register>
    <register>
      <name>DT8</name>
      <displayName>DT8</displayName>
      <description>Battery powered domain data
      register (BPR_DTx)</description>
    </register>
    <register>
      <name>DT9</name>
      <displayName>DT9</displayName>
      <description>Battery powered domain data
      register (BPR_DTx)</description>
    </register>
    <register>
      <name>DT10</name>
      <displayName>DT10</displayName>
      <description>Battery powered domain data
      register (BPR_DTx)</description>
    </register>
    <register>
      <name>DT11</name>
      <displayName>DT11</displayName>
      <description>Battery powered domain data
      register (BPR_DTx)</description>
    </register>
...
</registers>
    Caused by:
        0: Processing device `AT32F403`
        1: According to `BPR`
        2: Processing peripheral `BPR`
        3: Collecting registers matched to `DT?,DT[1][0]` in array
        4: BPR: registers cannot be collected into DT?,DT[1][0] array. Please, specify displayName

src/patch/mod.rs Outdated Show resolved Hide resolved
@burrbull burrbull marked this pull request as ready for review November 24, 2023 12:05
@burrbull
Copy link
Member Author

cc @kossnikita , @Emilgardis looks like solution is founded

@burrbull
Copy link
Member Author

let's merge this

@kossnikita
Copy link
Contributor

Wait a little longer please. I haven't finished my tests yet.

@kossnikita
Copy link
Contributor

LGTM. Could you update changelog?

@burrbull
Copy link
Member Author

LGTM. Could you update changelog?

Sure.

example/common_patches/tsc/tsc.yaml Outdated Show resolved Hide resolved
@burrbull burrbull added this pull request to the merge queue Nov 28, 2023
Merged via the queue into master with commit 83d5f10 Nov 28, 2023
12 checks passed
@Emilgardis Emilgardis deleted the desc branch December 19, 2023 16:42
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

Successfully merging this pull request may close these issues.

3 participants