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

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

Re: [avr-gcc-list] simple program


From: Timothy Smith
Subject: Re: [avr-gcc-list] simple program
Date: Thu, 25 Aug 2005 19:26:40 +1000
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050721)

Ian Caddy wrote:

hi Timothy,

You need to deifine the processor you are using when you call the compiler using the -m field, example we use the Mega128

-mmcu=atmega128

on the compiler line. Replace atmega128 with the processor that you are trying to build.

I hope this helps,

Ian Caddy


Timothy Smith wrote:

hi there i'm new to gcc and avr development and i've tried to make a
very simple program to turn on an LED connected to one of the pins.
cat led.c
#include <inttypes.h>
#include <avr/io.h>

int main(void)
{
   sbi(DDRD, 1);
   outb(PORTD,1);
}

and below you can see the error. i also tried i simple test program i
downloaded and i got similar errors, so i'm not sure what i'm doing wrong?

titan# avr-gcc led.c

In file included from led.c:2:
/usr/local/lib/gcc/avr/3.4.4/../../../../avr/include/avr/io.h:252:6:
warning: #warning "device type not defined"
led.c: In function `main':
led.c:6: error: `DDRD' undeclared (first use in this function)
led.c:6: error: (Each undeclared identifier is reported only once
led.c:6: error: for each function it appears in.)
led.c:7: error: `PORTD' undeclared (first use in this function)






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




ok thanks, i got a little further
avr-gcc -mmcu=atmega32 led.c
/var/tmp//ccK1E1Fr.o(.text+0x12): In function `main':
: undefined reference to `sbi'
/var/tmp//ccK1E1Fr.o(.text+0x20): In function `main':
: undefined reference to `outb'
titan# avr-gcc -mmcu=atmega32 -m led.c

i've actually compiled and run an simple program with avr-gcc before, i'm just missing something obvious.






reply via email to

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