
7 Dec
2006
7 Dec
'06
5:42 p.m.
-----Original Message----- From: Matthias Fuchs *)FPGA_BA; Making 'fpga' static solves the problem. But why?
Making it volatile will solve it.
The reason is that the ctrl member is not used anywhere else (except for some printf's) sothe compiler just strores the value in a register an optimizes away the access to the datastructure (and your hardware). By making it volatile, you force the compiler to never optimize away the accesses.
BTW. your original code would probably have worked with -O0 optimizattion level.