-
Notifications
You must be signed in to change notification settings - Fork 377
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
Possible need of "volatile" with dsb/isb instructions #634
Comments
As these things work, there is no need to change them. |
On the contrary - I'd think about removing the DSB (for example for audiostream), after a test. "voaltile" by nature kills performance :) |
Is there no chance of reordering, then, even with future compilers? Or maybe even the lines with |
don't know. |
There's no difference in using
See gcc docs. Reordering is a completely different story (that's independent of |
Thanks, @tsandmann. That makes it a little more clear. Is there even a way to disable reordering for these statements? Update: or maybe the compiler considers the “dsb” instruction non-reorderable? |
There is no difference, yes, so it does not hurt to just leave it there :) |
...and was it for GCC 5.4 the same? |
Did you see any issue because of reordering there? I don't think there's an easy way to guarantee that, but if it's an actual issue here, sth. like the example in the linked docs should work.
I don't think so, but adding |
According to gcc-5.4.0/gcc/Extended-Asm.html, yes. |
thanks! |
@tsandmann no issue with reordering that I know of. I thought that the comments in that forum post suggested that one must add volatile to prevent reordering. There’s some finer details which you pointed out. I’m just trying to learn more. Thanks for the info. :) |
I was reading this: https://forum.pjrc.com/threads/69288-Strange-IRQ_CMP0-behaviour-of-Teensy-3-2-help-needed-to-track-down-issue?p=298177&viewfull=1#post298177
and remembered I've seen
asm("dsb")
instructions without thevolatile
.The following places in this repo use this instruction without
volatile
:cores/teensy4/usb_serial.c
Line 343 in fdfd18f
cores/teensy4/usb_serial.c
Line 388 in fdfd18f
cores/teensy4/startup.c
Line 278 in 2e2dcf7
cores/teensy4/AudioStream.cpp
Line 335 in a2368ad
The text was updated successfully, but these errors were encountered: