avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Problem with TWI and ATmega128


From: Anton Erasmus
Subject: Re: [avr-gcc-list] Problem with TWI and ATmega128
Date: Thu, 24 Jan 2002 20:23:27 +0200

> Hi all,
> 
> I'm having problems compiling code to use the hardware TWI unit on the
> ATmega128.  I'm using gcc 3.0.2 and binutils-2.11.2 patched for the
> ATmega128, along with avr-libc-20020115.
> 
> If I try to compile the following piece of code:
> 
> ---begin---
> #include <io.h>
> #include <twi.h>
> 
> void i2c_start(void)
> {
>     outp(BV(TWINT) | BV(TWSTA) | BV(TWEN), TWCR);
> }
> ---end---
> 
> using 'avr-gcc -mmcu=atmega128 -O2 -c test.c', I get the following
> errors:
> 
> ---begin---
> test.c: In function `i2c_start':
> test.c:6: warning: asm operand 0 probably doesn't match constraints
> test.c:6: warning: asm operand 1 probably doesn't match constraints
> test.c:6: inconsistent operand constraints in an `asm' ---end---
> 
> Why isn't this working?  Some simple blink some LED's code works, so
> the tool chain is at least seemingly functional.
> 
> TIA,
> 

Hi,

The iomacros.h supplied with the current version of avr-gcc is 
broken for ATMega128. You have to fix the inp, outp and other 
macros. Attached is a patched version of iomacros.h, patched by 
myself and Matthias Lange <address@hidden>.

Regards
   Anton Erasmus
avr-gcc-list at http://avr1.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]