Forum Discussion
Altera_Forum
Honored Contributor
16 years agoStrange C code behavior under JTAG gdb
Hi there, I was trying to run the following simple test program on my DE3 board; it simply copies a 8-bit PIO register for input from the DIP switch to another one for output to the green LEDs. I n...
Altera_Forum
Honored Contributor
16 years agoThis code doesn't work if the CPU has a data cache. In that case it will read back the *switches value from the cache instead of reading the actual PIO value.
I guess it works when stepping in the code because the code executed by the debugger invalidates the cache line that used to hold the switches values, but it was pure luck. Use the IORD/IOWR macros to have a more reliable code.