Hello,

I wanted to use the _BV macro to set the JTD bit in MCUCR in order to
disable the JTAG interface and
allow the PF4-PF7 pins for other use.

The listing result is this:

    MCUCR |= _BV(JTD); // needs to be done twice
    9cf2:   85 b7           in  r24, 0x35   ; 53
    9cf4:   80 68           ori r24, 0x80   ; 128
    9cf6:   85 bf           out 0x35, r24   ; 53
    MCUCR |= _BV(JTD);
    9cf8:   85 b7           in  r24, 0x35   ; 53
    9cfa:   80 68           ori r24, 0x80   ; 128
    9cfc:   85 bf           out 0x35, r24   ; 53

As you can see the instruction is xoring a temporary value instead of
using the expected sbi.

On the other hand if I use the same approach for a normal port
register I get the desired result:
    DDRF |= _BV(PF4);
    2d66:   84 9a           sbi 0x10, 4 ; 16
    PORTF |= _BV(PF4);
    2d68:   8c 9a           sbi 0x11, 4 ; 17


Any ideas why _BV works for a port register but not for MCUCR?
I'm using AT90USB1287, avr-gcc 4.5.2.

Thanks,
  Omar

_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to