-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fixes issue with memory alignment in STM32 #3045
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
Conversation
When compiling with optimizations on, an issue occurs where the claimed_pins/never_reset_pins memory location is shared with another variable. This causes some bad memory read, so the USB pins ended up being reset. Setting these to have an alignment of 4 bytes resolves this. Tested on nucleo_f746zg
f61bc30
to
23da0fa
Compare
Why does it matter whether these two variables share a word? It shouldn't. |
It's not that they shouldn't share a word, but that they shouldn't cross a word boundary. I don't know why it affects that variable specifically...but some way that it's used is causing issues because it's crossing the word boundary. |
Some code might be accidentally treating them as |
I'd love to get to the real 100% cause of this, and I will, but I feel that this is a suitable fix for now. I'll keep looking at it, but I need to move on to the DAPIO issue asap. I tried switching everything to uint32_t, this didn't fix it either. |
@tannewt You told me once to ping you if PRs are not looked at for a few days...so here's your ping |
@k0d Yup! Thank you! I thought you were going to follow up with an update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix!
Haha...no...that's a good enough fix for now. I'll do some deep dive into it at some point...maybe bring it up at 'in the weeds' on a Monday. |
When compiling with optimizations on, an issue occurs where the claimed_pins/never_reset_pins memory location is shared with another variable. This causes some bad memory read, so the USB pins ended up being reset. Setting these to have an alignment of 4 bytes resolves this.
Tested on nucleo_f746zg