Society of Robots - Robot Forum

Software => Software => Topic started by: kupter on November 24, 2010, 11:37:58 PM

Title: WinAVR and AVRlib errors
Post by: kupter on November 24, 2010, 11:37:58 PM
I,m read all solution but  I'm still confuse
in my program like this

#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <stdio.h>
#include <buffer.h>
#include <global.h>
#include <uart2.h>
#include <avrlibdefs.h>
#include <avrlibtypes.h>

I already linked this program on M file

# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c uart2.c

but still there is error when I compile


Compiling C: uart2.c
avr-gcc -c -mmcu=atmega16 -I. -gstabs -DF_CPU=11059200UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./uart2.lst  -std=gnu99 -Wundef -MMD -MP -MF .dep/uart2.o.d uart2.c -o uart2.o
uart2.c: In function 'uart0Init':
uart2.c:60: error: 'UCSR0B' undeclared (first use in this function)
uart2.c:60: error: (Each undeclared identifier is reported only once
uart2.c:60: error: for each function it appears in.)
uart2.c: In function 'uart1Init':
uart2.c:79: error: 'UCSR1B' undeclared (first use in this function)
uart2.c: In function 'uart0InitBuffers':
uart2.c:95: warning: pointer targets in passing argument 2 of 'bufferInit' differ in signedness
uart2.c:96: warning: pointer targets in passing argument 2 of 'bufferInit' differ in signedness
uart2.c: In function 'uart1InitBuffers':
uart2.c:108: warning: pointer targets in passing argument 2 of 'bufferInit' differ in signedness
uart2.c:109: warning: pointer targets in passing argument 2 of 'bufferInit' differ in signedness
uart2.c: In function 'uartSetBaudRate':
uart2.c:133: error: 'UBRR1' undeclared (first use in this function)
uart2.c:140: error: 'UBRR0' undeclared (first use in this function)
uart2.c: In function 'uartSendByte':
uart2.c:166: error: 'UCSR1A' undeclared (first use in this function)
uart2.c:167: error: 'UDR1' undeclared (first use in this function)
uart2.c:171: error: 'UCSR0A' undeclared (first use in this function)
uart2.c:172: error: 'UDR0' undeclared (first use in this function)
uart2.c: In function 'uartTransmitService':
uart2.c:306: error: 'UDR1' undeclared (first use in this function)
uart2.c:308: error: 'UDR0' undeclared (first use in this function)
uart2.c: In function 'uartReceiveService':
uart2.c:332: error: 'UDR1' undeclared (first use in this function)
uart2.c:334: error: 'UDR0' undeclared (first use in this function)
uart2.c: At top level:
uart2.c:356: warning: 'SIG_UART0_TRANS' appears to be a misspelled signal handler
uart2.c:362: warning: 'SIG_UART1_TRANS' appears to be a misspelled signal handler
uart2.c:368: warning: 'SIG_UART0_RECV' appears to be a misspelled signal handler
uart2.c:374: warning: 'SIG_UART1_RECV' appears to be a misspelled signal handler
make.exe: *** [uart2.o] Error 1

I'm still confuse  what mistake I make.. I hope somebody can give me solution....




Title: Re: WinAVR and AVRlib errors
Post by: Admin on November 25, 2010, 07:10:24 AM
The error is because the compiler can't find the directories of these files.

You need to make sure your compiler knows where AVRlib is before compiling.
Title: Re: WinAVR and AVRlib errors
Post by: kupter on November 25, 2010, 11:06:18 AM
this my first time use Winavr so I'm don't know how to make compiler know?

I already put file Uart2.C and Uart2.h in same folder with main program.
Also I already try put this file sama folder in folder avr/include < default when I instal this programe> but it still does'nt work....
Title: Re: WinAVR and AVRlib errors
Post by: Admin on November 25, 2010, 11:16:19 AM
The original Axon code also uses AVRlib. Follow this tutorial *exactly* without skipping a step:
http://societyofrobots.com/axon/axon_getting_started_software.shtml (http://societyofrobots.com/axon/axon_getting_started_software.shtml)

Usually the problem happens when someone adds a space in a file name, or puts something in the wrong folder :P

(it's ok if you don't have an Axon, if it compiles that means you are doing it right)
Title: Re: WinAVR and AVRlib errors
Post by: kupter on November 25, 2010, 09:14:59 PM
(http://img72.imageshack.us/img72/2327/47854469.jpg)
when  follow step by step that tou advise just happen like this. I already put uart2.c and uart2.h same folder example I put my proeject in c:/new and Make file already I setting same with tutorial......

there is clue solution this programe.... as you know this program I use to my project use cmucam

this programe I use for atmega16... can it for this avr?
Title: Re: WinAVR and AVRlib errors
Post by: kupter on November 30, 2010, 12:12:37 AM
there somebody can help me
Title: Re: WinAVR and AVRlib errors
Post by: Admin on November 30, 2010, 08:29:04 AM
I recommend following my tutorial *exactly*, word for word, without changing a thing. It will then work.

Then you can modify it how you want.

The reason it isn't working is there is something you didn't follow correctly . . .
Title: Re: WinAVR and AVRlib errors
Post by: kupter on December 02, 2010, 08:46:27 PM
Tq admin... so I don't use program notepad...it is to complicated.... I decide to Avr studio... I juat copy paste my old program and make link with my avr lib( include libray), and I don't forget to add source file.c like uart.c  etc... finally my pogram can work...

tq for advice...