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

Filter out nullptr peripheral instances #54

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

mciantyre
Copy link
Member

There are a few peripheral instances that have NULL as their base address in the SVD. My guess is that NULL is a signal to humans to not use this address. If I remember correctly , the peripherals tagged with NULL require indirect access through ANATOP. Until this commit, we've generated those peripheral instances, despite the silly address.

However, a runtime check in NonNull will panic when the core library is built with debug assertions. Users may hit this panic if they build their firmware with this configuration, then try to acquire the individual peripheral instance or the Instances aggregate. The panic in the latter case is inconvenient, especially when the user doesn't care about these instances.

This commit removes these NULL instances from the public API. I'm keeping the register blocks; pairing core::mem::offset_of! with register blocks is useful.

For convenience / ease of implementation, I'm doing the filtering down in the codegen step of raltool. It would be better to implement this as a standard transform / cleanup step that kept the register block while discarding the instances. We can try this later.

I plan to release this breaking change in the 0.5 and 0.6 series. This will affect users who were relying on these incorrect symbols.

There are a few peripheral instances that have `NULL` as their base
address in the SVD. My guess is that `NULL` is a signal to humans to not
use this address. If I remember correctly , the peripherals tagged with
`NULL` require indirect access through ANATOP. Until this commit, we've
generated those peripheral instances, despite the silly address.

However, a runtime check in `NonNull` will panic when the core library
is built with debug assertions. Users may hit this panic if they build
their firmware with this configuration, then try to acquire the
individual peripheral instance or the `Instances` aggregate. The panic
in the latter case is inconvenient, especially when the user doesn't
care about these instances.

This commit removes these `NULL` instances from the public API. I'm
keeping the register blocks; pairing `core::mem::offset_of!` with
register blocks is useful.

For convenience / ease of implementation, I'm doing the filtering down
in the codegen step of `raltool`. It would be better to implement this
as a standard transform / cleanup step that kept the register block
while discarding the instances. We can try this later.

I plan to release this breaking change in the 0.5 and 0.6 series. This
will affect users who were relying on these incorrect symbols.
@mciantyre mciantyre force-pushed the remove-null-instances branch from 86770ee to 9806022 Compare December 20, 2024 00:44
@mciantyre mciantyre merged commit 9806022 into imxrt-rs:master Dec 20, 2024
24 checks passed
@mciantyre mciantyre deleted the remove-null-instances branch December 20, 2024 00:53
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.

1 participant