alex31 thanks for clarification and the tip.
Giovanni,
I imagine that the compiler just calls some library functions for mutual exclusion
You are right about that. Instead of `int` I declared my variable as `long long` :
And I got these linker errors:
Code: Select all
undefined reference to `__atomic_load_8'
undefined reference to `__atomic_store_8'
I think it would be nice if ChibiOS provided such functions to support C11. What do you think?
By the way, in case of `_Atomic(int)`, compiler puts a `DMB` instruction before and after operations on this variable. According to my research, this operator doesn't mean anything for Cortex-M processors. But for more advanced processors it disables some runtime optimizations.