Compiling code for an ATMega328 with AVRStudio4, using avrgcc tools.
I tried to turn on the pullup on PD4 (pin 6). It wouldn't turn on,
unless I also set the pullup on PD1.
Here is the C code, and the generated assembly from the .lss file:
(Data direction register already set).
PORTD |= 0x00010000;
EC6: 8b b1 in r24, 0x0b
EC8: 8b b9 out 0x0b, r24
(this code doesn't set the PD4 pullup)
PORTD |= 0x00010010;
EC6: 5c 9a SBI 0x0b, 4
(this code does set the PD4 pullup)
Turning the optimization level from -Os to O0 makes the thing work, but greatly increases code size.
How could either of the above be correct compilations?
Thanks for any thoughts,