[En-Nut-Discussion] Led example error
Lorenzo Verniani
lorenzoverniani at gmail.com
Thu Jun 1 15:28:55 CEST 2006
I edited led example source adding printf("xxxxx")
Compiling by gcc i receive this error:
avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall
-Wstrict-prototypes -Wa,-ahlms=led01.lst -DETHERNUT2 -D__HARVARD_ARCH__
-I/home/lorenzo/ethernut-4.0.3-bld/include
-I/home/lorenzo/ethernut-4.0.3/include
led01.c -o led01.o
led01.c: In function `NutAppMain':
led01.c:26: warning: implicit declaration of function `printf'
avr-gcc led01.o -mmcu=atmega128 -Wl,--defsym=main=0,-Map=led01.map,--cref
-L/home/lorenzo/ethernut-4.0.3-bld/lib
/home/lorenzo/ethernut-4.0.3-bld/lib/nutinit.o
-lnutpro -lnutos -lnutarch -lnutdev -lnutnet -lnutfs -lnutcrt -o led01.elf
/home/lorenzo/ethernut-4.0.3-bld/lib/libnutcrt.a(open.o)(.text+0x5a): In
function `_open':
: undefined reference to `NutDeviceLookup'
make: *** [led01.elf] Error 1
the source.c is the following (my edits are evidenced):
/*
* This header contains the Nut/OS timer function
* prototypes. We need it for calling NutSleep.
*/
#include <sys/timer.h>
#include <avr/sleep.h>
#include <stdio.h>
/*
* Ethernut LED example #1.
*/
int main(void)
{
/*
* Configure port E bit 2 as an output.
*/
sbi(DDRE, 2);
/*
* An endless loop.
*/
for (;;) {
/*
* Set port E bit 2 to low. This will lit the LED.
*/
cbi(PORTE, 2);
printf("led on");
/*
* Sleep 1000 milliseconds.
*/
NutSleep(1200);
/*
* Setting port E bit 2 to high switches off the LED.
*/
sbi(PORTE, 2);
/*
* Sleep for another 300 milliseconds.
*/
NutSleep(300);
cbi(PORTE, 2);
NutSleep(500);
sbi(PORTE, 2); // corto
NutSleep(300);
cbi(PORTE, 2); /* lungo */
NutSleep(1200);
sbi(PORTE, 2);
NutSleep(3000);
}
}
Best regards.
Lorenzo Verniani
More information about the En-Nut-Discussion
mailing list