I've spent a good while getting my AVR development system set up with the full GCC tool chain (everything is the most recent current stable version) and I have solved most issues with it but one.
This following code gives me an error which I just don't get. The AVR assembly manual states that the sbi instruction can accept 0-7 as a constant expression but it still errors out on me. Can anyone shed some light onto why it does this please?
#ifndef __AVR_ATmega168__
#define __AVR_ATmega168__
#endif
#include <avr/io.h>
rjmp Init
Init:
ser r16
out DDRB, r16
out DDRD, r16
clr r16
out PORTB, r16
out PORTD, r16
Start:
sbi PORTB, 0
rjmp Start
The line in question is sbi PORTB, 0.
Compiled / assembled with:
avr-gcc ledon.S -mmcu=atmega168