On 08/03/2012 04:07 PM, Greg Ungerer wrote:
The compiler is still free to read into a register, work on the value
and then write it back. As long as the read and the write do still
occur.
Yep I do know this. Using volatile I just wanted to ensure that in fact
the memory cell is accessed. But in fact maybe the compiler really with
"volatile" generates less optimized code then without, even if manually
optimizing would lead to identical code.
I suppose, for testing, I should do a non volatile global variable so
that same needs to be left in a defined state when exiting the function.
If you are looking for atomic access then you need to do a little
more magic.
I do know this. For ensuring atomic operation you do need to use
(inline) ASM (macros).
But this is a different matter. Here I wanted to verify that the
compiler creates good code in the said cases (using memory in a not
explicitly volatile way).
thanks,
-Michael
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev