|ARM Technical Support Knowledge Articles|
Applies to: General Topics
Is there any way to totally disable optimizing? I need to do 2 consecutive reads of an external unsigned byte pointer. Instead of reading it the second time, the compiler just gives me the value from the first read. I tried setting optimizer to zero, but it didn't change.
Multiple accesses to the same external variable may require that the variable is declared as volatile. This will force the compiler to access the variable the second time. Variables are declared this way as follows:
volatile unsigned char variable;
For more information, refer to the volatile keyword in Kernighan & Ritchie's "The C Programming Language". Also, refer to the ABSACC.H header file in the C51INC directory for an example of absolute memory access macros.
Article last edited on: 2001-11-07 00:00:00
Did you find this article helpful? Yes No
How can we improve this article?