Skip to content

Share Ada type for derivedFrom peripherals with no own registers - #118

Open
ThyMYthOS wants to merge 1 commit into
AdaCore:masterfrom
ThyMYthOS:peripheral-folding
Open

ThyMYthOS wants to merge 1 commit into
AdaCore:masterfrom
ThyMYthOS:peripheral-folding

Conversation

@ThyMYthOS

Copy link
Copy Markdown

A derivedFrom peripheral that declares no of its own is, by SVD semantics, just another instance of its base peripheral's layout. Read_Peripheral unconditionally overwrote Type_Name with the peripheral's own name, so it always got a distinct, duplicate record type, and Device.Dump bucketed peripherals only by groupName, so a groupless derivedFrom peripheral always got its own file too.

Read_Peripheral now tracks whether a peripheral declares its own or , and restores the base's Type_Name when neither is present. Device.Dump gains a second grouping pass: groupless peripherals that end up sharing a Type_Name are folded into one synthetic group (labeled by that Type_Name) and handed to the existing Group_Name-based Dump, which already emits one shared type when content matches and falls back to separate types otherwise.

Peripherals with their own registers, their own headerStructName, or an explicit groupName are unaffected.

@CLAassistant

CLAassistant commented Oct 6, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

A derivedFrom peripheral that declares no <registers> of its own is,
by SVD semantics, just another instance of its base peripheral's
layout. Read_Peripheral unconditionally overwrote Type_Name with the
peripheral's own name, so it always got a distinct, duplicate record
type, and Device.Dump bucketed peripherals only by groupName, so a
groupless derivedFrom peripheral always got its own file too.

Read_Peripheral now tracks whether a peripheral declares its own
<registers> or <headerStructName>, and restores the base's Type_Name
when neither is present. Device.Dump gains a second grouping pass:
groupless peripherals that end up sharing a Type_Name are folded into
one synthetic group (labeled by that Type_Name) and handed to the
existing Group_Name-based Dump, which already emits one shared type
when content matches and falls back to separate types otherwise.

Peripherals with their own registers, their own headerStructName, or
an explicit groupName are unaffected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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