go_away

Author Topic: WinAVR and AVRlib errors  (Read 2483 times)

0 Members and 1 Guest are viewing this topic.

Offline kupterTopic starter

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 0
WinAVR and AVRlib errors
« 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....





Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,660
  • Helpful? 169
    • Society of Robots
Re: WinAVR and AVRlib errors
« Reply #1 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.

Offline kupterTopic starter

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 0
Re: WinAVR and AVRlib errors
« Reply #2 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....
« Last Edit: November 25, 2010, 11:09:42 AM by kupter »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,660
  • Helpful? 169
    • Society of Robots
Re: WinAVR and AVRlib errors
« Reply #3 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

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)

Offline kupterTopic starter

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 0
Re: WinAVR and AVRlib errors
« Reply #4 on: November 25, 2010, 09:14:59 PM »

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?
« Last Edit: November 25, 2010, 09:40:41 PM by kupter »

Offline kupterTopic starter

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 0
Re: WinAVR and AVRlib errors
« Reply #5 on: November 30, 2010, 12:12:37 AM »
there somebody can help me

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,660
  • Helpful? 169
    • Society of Robots
Re: WinAVR and AVRlib errors
« Reply #6 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 . . .

Offline kupterTopic starter

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 0
Re: WinAVR and AVRlib errors
« Reply #7 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...

 


Get Your Ad Here