Forum Discussion
Altera_Forum
Honored Contributor
20 years agoVolatile... or is it??
Hi there, I just wanted to save you guys some gray hairs when working with pointers to your hardware in a kernel module. I had a module with a volatile struct pointing to the registers of my ...
Altera_Forum
Honored Contributor
20 years agoHi All,
> If I remember correctly, the volatile keyword does not cause the Nios II compiler to > generate code to bypass the cache. Correct. And it shouldn't ... the presence of a cache (or lack thereof) has nothing to do with compiler optimizations that may affect the stability of the object. With gcc the volatilie keyword traditionally boils down to accessing the object each time it is referenced ... nothing more. If you're accessing hardware registers, do yourself a favor and use the HAL macros -- that's what they're for. Regards, --Scott