It has been a while since i posted, but now i'm witness to very strange results with -Os optimisation;
while ((PIND & _BV(D0)) != 0);
When compiling this code snippet with optimisation turned off i get this result;
LDS R24,0x0030 Load direct from data space CLR R25 Clear Register ANDI R24,0x04 Logical AND with immediate ANDI R25,0x00 Logical AND with immediate SBIW R24,0x00 Subtract immediate from word BREQ PC+0x02 Branch if equal RJMP PC-0x0007 Relative jump
Obviously correct compilation and does the trick with the hardware attached, when optimation turned to -Os the result;
SBIC 0x10,2 Skip if bit in I/O register cleared RJMP PC-0x0001 Relative jump
Correct compilation/optimisation but doesn't work with the hardware.
Is there something i'm missing here? Has anyone witnessed the same behaviour before?
BTW. D0 is defined PD2
Thanks for any input...