
7 Dec
2006
7 Dec
'06
5:55 p.m.
On Thursday 07 December 2006 17:42, Rune Torgersen wrote:
-----Original Message----- From: Matthias Fuchs *)FPGA_BA; Making 'fpga' static solves the problem. But why?
Making it volatile will solve it.
I tried that - of course. But it didn't solve the problem.
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.
Yes, it does.
Matthias
--
-----------------------------------------------------------------------
Dipl.-Ing. Matthias Fuchs esd electronic system design gmbh
http://www.esd-electronics.com Vahrenwalder Str. 207
phone: +49-511-37298-0, fax: -68 30165 Hannover, Germany
-----------------------------------------------------------------------