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

[monotonics] Fix STM32 read-modify-write race condition #984

Merged
merged 5 commits into from
Oct 23, 2024

Conversation

Finomnis
Copy link
Contributor

The SR register for STM32 clears when writing a zero to a bit. Therefore, all registers that should not be cleared need to be 1.

modify here caused a read-modify-write error that could clear unrelated flags.

Related: libopencm3/libopencm3#392
Fixes: #956

The `SR` register for STM32 clears when writing a zero to a bit.
Therefore, all registers that should not be cleared need to be `1`.

`modify` here caused a read-modify-write error that could clear
unrelated flags.
@Finomnis Finomnis mentioned this pull request Oct 22, 2024
@Finomnis Finomnis force-pushed the fix_stm32_monotonic branch from a8e467b to 185bf36 Compare October 22, 2024 17:25
@Finomnis
Copy link
Contributor Author

Needs testing on target.

@Finomnis
Copy link
Contributor Author

This might be enough of a bug to yank previous rtic-monotonic 2.0.x versions.

@korken89
Copy link
Collaborator

LGTM thank for fixing! Have this been tested on HW?
If so I'll prepare a release.

@Finomnis
Copy link
Contributor Author

LGTM thank for fixing! Have this been tested on HW? If so I'll prepare a release.

Not by me yet.
I'll do so soon.

@korken89
Copy link
Collaborator

Ping me when ready and I'll prepare a release.
Please do it on Matrix, something is weird with my email notifications from GH that I have not figured out...

@Finomnis
Copy link
Contributor Author

@korken89 Runs realiably in debug but crashes immediately in release. Something is wrong with the init code, give me a second.

@Finomnis
Copy link
Contributor Author

@korken89 Seems like that fixed it.

@Finomnis Finomnis force-pushed the fix_stm32_monotonic branch 2 times, most recently from 2b3331a to e752d0f Compare October 23, 2024 19:15
Copy link
Collaborator

@korken89 korken89 left a comment

Choose a reason for hiding this comment

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

Thank you for fixing!

@korken89 korken89 added this pull request to the merge queue Oct 23, 2024
Merged via the queue into rtic-rs:master with commit 3dfef74 Oct 23, 2024
55 checks passed
@Finomnis Finomnis deleted the fix_stm32_monotonic branch October 23, 2024 19:30
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.

rtic-monotonic panics
3 participants