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

Fix mass-erase trigger on "small" devices. #210

Merged
merged 4 commits into from
Feb 8, 2024
Merged

Fix mass-erase trigger on "small" devices. #210

merged 4 commits into from
Feb 8, 2024

Conversation

BryanKadzban
Copy link
Contributor

The list of specifically enumerated "large" devices has the correct set of register operations to start a mass erase, setting the mer1 and mer2 bits. But the "small-devices" alternative does not; it clears the mer bit instead of setting it.

Looking at history, this was changed from set to clear in the PR that added support for "large" devices. It appears to have been accidental.

The list of specifically enumerated "large" devices has the correct set
of register operations to start a mass erase, setting the mer1 and mer2
bits.  But the "small-devices" alternative does not; it clears the mer
bit instead of setting it.

Looking at history, this was changed from set to clear in the PR that
added support for "large" devices.  It appears to have been accidental.
@BryanKadzban
Copy link
Contributor Author

The CI tests are failing due to the nightly compiler change to reject all references to mutable statics, not due to this change.

Copy link
Member

@eldruin eldruin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks!
Could you add an entry to the changelog about this?
Could you also add the couple of addr_of_mut! calls so that the nightly compiler is happy? (this does not need a changelog entry)

This is mostly a workaround, because Pin<> requires a reference, not a
pointer, but the rust compiler change wants users to use pointers (via
addr_of_mut!()), not references.  In this particular case, we don't
actually *need* Pin<>, because the static mut won't be moved anyway, but
we can't prove that to the DMA API without it.

So deref the addr_of_mut!() pointer, and make a ref to it, rather than
restructuring the DMA API to work on raw pointers (and somehow enforce
the Pin<> guarantees on the pointed-to data).
Missed these in the previous commit because I did not test locally with
the `rt` feature enabled.
@BryanKadzban
Copy link
Contributor Author

Could you add an entry to the changelog about this?

Done.

Could you also add the couple of addr_of_mut! calls so that the nightly compiler is happy? (this does not need a changelog entry)

Also done.

Thanks!

Copy link
Member

@eldruin eldruin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you!

@eldruin eldruin merged commit cf23006 into stm32-rs:main Feb 8, 2024
15 checks passed
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