Is there any way to temporarily disable the GCC compiler optimization for specific C code?
Only as an example, I believe this is how CodeVision would accomplish this type of task in the C source code:
#pragma optsize- CLKPR=0x80; CLKPR=0x00; #ifdef _OPTIMIZE_SIZE_ #pragma optsize+ #endif
If I have to, I suppose I could write the never to be optimized GCC code as in-line assembly.
The problem is an internal AVR operation clears a bit in a 16 bit SFIOR and at the same time sets a bit or bits in a different 8 bit SFIOR. I am afraid that source code optimization (current or in the future versions) could screw up how these simultaneous SFIOR event values are read and responded to by an optimized C code IF() test. I do not want to get a false IF(SFIOR_16_bit_clear && SFIOR_8_bits_cleared) response because a SFIOR value is reused, read early or late out of sequence (using the AVR hardware behavior to define the critical sequencing). In theory even if I split up the 16 and 8 bit SFIOR tests, the optimizer could recombine them for me, so I just want to temporarily disable the optimization in the GCC source code.