[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] ATMega16 #include trouble?
From: |
E. Weddington |
Subject: |
Re: [avr-gcc-list] ATMega16 #include trouble? |
Date: |
Thu, 10 Feb 2005 13:36:22 -0700 |
User-agent: |
Mozilla Thunderbird 0.7.3 (Windows/20040803) |
Heiko Engelke wrote:
Hallo,
I'm a beginner with Atmel processors, still trying to get some simple
programs running. But I keep getting some very strange errors with
very basic things that I just don't understand. I am using avr-libc in
version 1.0.2 (Included in the binary Mac package from [1]).
avr-libc version 1.0.2 is outdated. The latest version is 1.2.2.
Here's the first problem: My ATMega16 is not a valid MMCU, avr-gcc says.
Then you have an old version of avr-gcc.
The latest version is 3.4.3.
avr-libc seems to support it, so I think atmega16 should exist :-(
Support for a device is required in three projects: GNU Binutils, GCC,
and avr-libc. Just because you have one project that supports it,
doesn't mean that the others do.
FYI: the latest binutils version is 2.15.
$ avr-gcc -mmcu=atmega16 foo.c
Unknown MCU `atmega16' specified
...
Now that I'm using atmega161 as a workaround, some defines do not
exist. There is no #define for UBRRL, while UBRRH exists. Strange ...
is this normal? What do I need to do to avoid this problem?
Stop using a "workaround". Get your tools updated and use the correct
mcu definition which will pull in the correct IO header file.
$ cat foo.c
#include <io.h>
Wrong. You need to change that to:
#include <avr/io.h>
#define BAUD 42 // still to do
int main() {
outp((unsigned char)(BAUD>>8), UBRRH);
outp((unsigned char)BAUD, UBRRL);
}
And STOP using outp(), inp(), outb(), inb(), sbi() and cbi() macros.
They are all deprecated and they are removed in avr-libc >= 1.2.0.
[1] http://www.eecs.berkeley.edu/~mseeman/resources/macmicro.html
Looks like those are outdated tools.
You'll have to either build them yourself, or somebody else on this list
who uses a Mac could perhaps post a location to get a binary download of
the latest tools.
Eric