Hi all,
I have a piece of code that has some commands in inline assembly and I would like to be 100% sure that the compiler does not mess with the code as I need it to run in exactly that order.
So far, I have tried formatting each line as
__asm__ volatile("...code...\n\t":::"memory");
and I have tried to change the compiler optimization settings to -O0 and -Og.
However, for some reason, it seems that the compiler is still "optimizing"/rearranging the code.
Any ideas of what this might be or suggestions for how to remedy this would be greatly appreciated.
(PS. I understand that the compiler optimizations are useful for making code more efficient and faster, but that is not something I am concerned with in this case. The timing of this code is absolutely crucial and so it is important that the code remains unaltered.)
Thank you all for your help