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

Equate fieldset names #33

Merged
merged 4 commits into from
Jul 3, 2023
Merged

Equate fieldset names #33

merged 4 commits into from
Jul 3, 2023

Conversation

mciantyre
Copy link
Member

Omitting checks for fieldset names allowed the combine pass to eagerly merge fieldsets it believed were equivalent. Consider the LPI2C.SIER register. On the 1000 series, the "address match 1 interrupt enable" field is called "AM1IE." And on the 1100 series, the same field is called "AM1F." Same meaning, but a different name. By eagerly combining, we have no need to generate another lpi2c.rs file, and we have 1675 fewer lines of code.

The assumption fails when that name difference is meaningful, like when NXP changes the CCM.CS1CDR field at offset 25 from FLEXIO1_CLK_PODF to FLEXIO2_CLK_PODF. Those aren't equivalent fields, but we don't know that because we're not checking the field name.

It's always correct to not combine. And turns out it's not adding too much code; we can patch the small name corrections like the LPI2C example.

This PR ensures the combiner always equates fieldset names. It also adds raltool patches to rename specific fieldsets that truly should have the same name. The PR corrects the concrete case identified in #32, but it does not fully address the greediness problem. See individual commits for more information and to simplify review.

CHANGELOG.md Outdated Show resolved Hide resolved
Omitting this check allowed the combine pass to eagerly merge fieldsets
it believed were equivalent. Consider the LPI2C.SIER register. On the
1000 series, the "address match 1 interrupt enable" field is called
"AM1IE." And on the 1100 series, the same field is called "AM1F." Same
meaning, but a different name. By eagerly combining, we have no need to
generate another lpi2c.rs files, and we have 1675 fewer lines of code.

The assumption fails when that name difference is meaningful, like when
NXP changes the CCM.CS1CDR field at offset 25 from FLEXIO1_CLK_PODF to
FLEXIO2_CLK_PODF. Those aren't equivalent fields, but we don't know that
because we're not checking the field name.

It's always correct to not combine. And turns out it's not adding
too much code; we can patch the small name corrections like the LPI2C
example. Those patch commits are children of this commit.
See the parent commit for more context. With this patch, we can still
combine the LPI2C peripherals across all peripherals.

Since field combinations wasn't considering names, the combiner was free
to select any version of the field as the base. It happened to pick the
"less good" field name for all peripherals. This commit ends up changing
the source as a consequence of the rename.
Selecting the longer name for clarity, and because the longer name is
used in more MCU SVDs.
This fixes the CCM.CS1CDR FLEXIO1 vs FLEXIO2 field name descrepancy.
It also seems to correct a field name in the an 1176 SNVS register.

The newly-added TRNG is because there's a field name that correctly
changes as a result of the combiner policy change.
@mciantyre mciantyre marked this pull request as ready for review July 3, 2023 12:25
@mciantyre mciantyre merged commit 2a43e2d into master Jul 3, 2023
41 checks passed
@mciantyre mciantyre deleted the equate-fieldset-names branch July 3, 2023 12:43
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.

2 participants