Merge bit fields that only moved inside their own register - #18
Merged
Merged
Conversation
…ster Source compatibility located a register by its name, since a CMSIS header abstracts the offset away into a structure member, but still located a bit field by its position. A header abstracts the position just as much into its _Pos and _Msk macros, so a bit field that keeps both its name and its register is now relocated instead of a conflict. This is the only difference between the two IWDG implementations: the early wake-up flag IWDG_SR_EWIF is bit 15 on the STM32WBA2 and bit 14 on the STM32WBA5, which the headers, the ST SVD files and RM0521 and RM0493 all agree on, so the flag alone split every STM32 into two watchdogs. A bit field that is permuted inside its register is not relocated, since its position is what it means: bit 9 of GTZC_TZSC_SECCFGR1 is USART2 on one device and WWDG on another. A permutation therefore renames every position it touches, while a relocation moves into bits that nobody else claims. Source variants go from 319 to 300 and similar from 282 to 268, binary is unchanged. The relocated bit fields are drawn at each of their positions and listed per variant in the explorer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #17, which left source compatibility half-applied.
The inconsistency
sourcemode located a register by its name, because a CMSIS headerabstracts the offset away into a structure member. But it still located a bit
field by its position, even though the same header abstracts the position
just as much into its
_Posand_Mskmacros.So a bit field that keeps both its name and its register is now a relocation
instead of a conflict.
Why IWDG had two variants
This was the only difference between the two
IWDGimplementations:The early wake-up flag is bit 15 on the STM32WBA2 and bit 14 on the STM32WBA5.
Everything else —
KR,PR,RLR, the rest ofSR,WINR,EWCR— linesup exactly, so one flag split every STM32 into two watchdogs.
It is not a data bug. All three sources agree with each other on both sides:
IWDG_SR_EWIF_Pos (15UL)(14UL)<bitOffset>15</bitOffset>14IWDGis now one variant across all 287 devices.Permutations are not relocations
A bit field permuted inside its register keeps its conflict, since its position
is what it means. Bit 9 of
GTZC_TZSC_SECCFGR1isUSART2on one device andWWDGon another, and merging those would give a map where 116 peripherals eachclaim two bits.
The two are separable: a permutation renames every position it touches, while a
relocation moves into bits that nobody else claims. Without that guard, source
variants collapse to 280 and
GTZC_TZSCwrongly merges to 1.Results
Twelve groups collapse:
DBGMCU8→5,RCC29→25,EXTI8→6,SDMMC4→2,PWR15→14,TAMP3→2, andIWDG,WWDG,VREFBUF,DCACHE,HASH,GFXMMU2→1.Explorer
Relocated fields are drawn at each of their positions with a dashed outline,
tagged
· relocatedin the inspector, and listed per variant under "Moved, butthe same bit field". The gist is already updated.
The regrouping created 214 new feature keys, which Gemma named, so the published
table went 2623 → 2837 and every one of the 6184 feature slots is named.
Note
The rule also merges EXTI's
EMR1.EMmask variants (EMR1[30:19]vsEMR1[31:30]) in source mode.documentation_only()already tolerated those insimilarmode, so it is consistent, but it is a looser case than the cleanEWIFrelocation.