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

35 compilation fail when in svd file is used headerstructname in cluster declaration #37

Conversation

pellico
Copy link
Contributor

@pellico pellico commented Aug 13, 2024

By creating this pull request you agree to the terms in CONTRIBUTING.md.
https://github.com/Infineon/.github/blob/master/CONTRIBUTING.md
--- DO NOT DELETE ANYTHING ABOVE THIS LINE ---

CONTRIBUTING.md also tells you what to expect in the PR process.

Description
Cluster module name is derived from headerStructName if present otherwise cluster name is used.
Previously the name of module was derived from struct name and not directly from headerStructName.
If the name contains underscore this was lost in conversion. In fact underscore is allowed in module names but not in struct name.
e.g. hsl_hsl (cluster name) --> hslhsl(struct name) --> hslhsl (module name)
Now the module name is derived directly from cluster name
hsl_hsl(cluster name) --> hsl_hsl(module name)

Related Issue
#35

Cluster module name is derived from headerStructName if present otherwise cluster name is used.
@pellico pellico merged commit d1156fc into main Aug 19, 2024
7 checks passed
@pellico pellico deleted the 35-compilation-fail-when-in-svd-file-is-used-headerstructname-in-cluster-declaration branch August 19, 2024 15:46
jnkr-ifx added a commit to jnkr-ifx/svd2pac that referenced this pull request Aug 29, 2024
…re identifiers

PR Infineon#37 uses the headerStructName field to define module and structure
names. However, this change was not consistely applied throughout the
generated code -- most references to peripherals use the peripheral name
even if a header struct name is explicitly set. PSoC SVD files produce
many compile errors when Infineon#37 is applied due to this inconsistency.

This commit changes all references to peripheral structures and modules
to use the `module_id` and `struct_id` fields instead of inferring it
from the peripheral names. Additionally, the peripheral `module_id` is
now derived from the `headerStructName` for consistency with the logic
in `push_current_item_svd_path`.

I encountered some issues with feature flags -- the existing logic in
`Cargo_toml.tera` assumed that, in the case of a derived peripheral, the
peripheral's feature flag would be the peripheral's name converted to a
module identifier, and that the parent feature flag would be the
peripheral's module identifier. However, in the case of peripheral
derived from a struct with a `headerStructName`, this logic fails as the
parent peripheral's name is not the same as its module identifier. I
fixed this by changing the feature flag name to match the module name
instead of the peripheral name. This change means derived peripherals no
longer have separate feature flags from their parents.

Lastly, this commit adds a test case of a simple peripheral with a
headerStructName, which fails before this commit and passes after.
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.

Compilation fail when in svd file is used headerStructName in cluster declaration.
2 participants