Forum Discussion
Altera_Forum
Honored Contributor
15 years agoMaking variables 'volatile' doesn't cause the data cache to be bypassed.
It is probably required [1] to ensure that all the memory transfers requested by the C source actually happen, and in the correct order. Passing -mno-cache-volatile to the compiler will cause it to use ldio/stio instructions for volatile data. But it would be more useful if this were a separate attribute. [1] judicious use of memory barriers [2] can have the desired effect. [2] eg asm volatile("\n":::"memory") tells gcc that any of memory might have changed - so it must not have memory cached in registers (and v.v.) across the statement.