Once I do this step:
Open up your makefile, and add in rprintf.c and uart.c if it isn't already there:
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c a2d.c buffer.c rprintf.c uart.c
I get a bunch of errors in the UART.c file ... anyone have any idea what it is or what I'm doing wrong? I'm using the AVRISPII with an atmega328p.
Build started 26.7.2009 at 19:28:38
-------- begin --------
avr-gcc (WinAVR 20090313) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiling: Photovore_v1.c
avr-gcc -c -mmcu=atmega328p -I. -gstabs -O0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=Photovore_v1.lst -std=gnu99 -Wp,-M,-MP,-MT,Photovore_v1.o,-MF,.dep/Photovore_v1.o.d Photovore_v1.c -o Phot
ovore_v1.o
Compiling: a2d.c
avr-gcc -c -mmcu=atmega328p -I. -gstabs -O0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=a2d.lst -std=gnu99 -Wp,-M,-MP,-MT,a2d.o,-MF,.dep/a2d.o.d a2d.c -o a2d.o
a2d.c:110: warning: 'SIG_ADC' appears to be a misspelled signal handler
Compiling: buffer.c
avr-gcc -c -mmcu=atmega328p -I. -gstabs -O0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=buffer.lst -std=gnu99 -Wp,-M,-MP,-MT,buffer.o,-MF,.dep/buffer.o.d buffer.c -o buffer.o
Compiling: rprintf.c
avr-gcc -c -mmcu=atmega328p -I. -gstabs -O0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=rprintf.lst -std=gnu99 -Wp,-M,-MP,-MT,rprintf.o,-MF,.dep/rprintf.o.d rprintf.c -o rprintf.o
Compiling: uart.c
avr-gcc -c -mmcu=atmega328p -I. -gstabs -O0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=uart.lst -std=gnu99 -Wp,-M,-MP,-MT,uart.o,-MF,.dep/uart.o.d uart.c -o uart.o
uart.c: In function 'uartInit':
uart.c:52: error: 'UCR' undeclared (first use in this function)
uart.c:52: error: (Each undeclared identifier is reported only once
uart.c:52: error: for each function it appears in.)
uart.c:52: error: 'RXCIE' undeclared (first use in this function)
uart.c:52: error: 'TXCIE' undeclared (first use in this function)
uart.c:52: error: 'RXEN' undeclared (first use in this function)
uart.c:52: error: 'TXEN' undeclared (first use in this function)
uart.c: In function 'uartInitBuffers':
uart.c:70: warning: pointer targets in passing argument 2 of 'bufferInit' differ in signedness
uart.c:72: warning: pointer targets in passing argument 2 of 'bufferInit' differ in signedness
uart.c: In function 'uartSetBaudRate':
uart.c:93: error: 'UBRRL' undeclared (first use in this function)
uart.c: In function 'uartSendByte':
uart.c:119: error: 'UDR' undeclared (first use in this function)
uart.c: At top level:
uart.c:230: warning: 'SIG_UART_TRANS' appears to be a misspelled signal handler
uart.c: In function 'SIG_UART_TRANS':
uart.c:239: error: 'UDR' undeclared (first use in this function)
uart.c: At top level:
uart.c:258: warning: 'SIG_UART_RECV' appears to be a misspelled signal handler
uart.c: In function 'SIG_UART_RECV':
uart.c:263: error: 'UDR' undeclared (first use in this function)
make: *** [uart.o] Error 1
Build failed with 11 errors and 5 warnings...
And when I do this step:
Now after deciding on baud, in the file SoR_Utils.h (or in your main if you want) add the following code to your initialization (using your chosen BAUD rate):
uartInit(); // initialize UART
uartSetBaudRate(38400);// set UART baud rate
rprintfInit(uartSendByte);// initialize rprintf system
I get these errors:
Build started 26.7.2009 at 19:44:04
-------- begin --------
avr-gcc (WinAVR 20090313) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Size before:
Photovore_v1.elf :
section size addr
.text 1044 0
.bss 1 8388864
.stab 2784 0
.stabstr 3049 0
Total 6878
Compiling: Photovore_v1.c
avr-gcc -c -mmcu=atmega328p -I. -gstabs -O0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=Photovore_v1.lst -std=gnu99 -Wp,-M,-MP,-MT,Photovore_v1.o,-MF,.dep/Photovore_v1.o.d Photovore_v1.c -o Phot
ovore_v1.o
In file included from Photovore_v1.c:3:
SoR_Utils.h:33: warning: data definition has no type or storage class
SoR_Utils.h:33: warning: type defaults to 'int' in declaration of 'uartInit'
SoR_Utils.h:33: warning: function declaration isn't a prototype
SoR_Utils.h:33: error: conflicting types for 'uartInit'
uart.h:165: error: previous declaration of 'uartInit' was here
SoR_Utils.h:34: error: expected declaration specifiers or '...' before numeric constant
SoR_Utils.h:34: warning: data definition has no type or storage class
SoR_Utils.h:34: warning: type defaults to 'int' in declaration of 'uartSetBaudRate'
SoR_Utils.h:34: warning: function declaration isn't a prototype
SoR_Utils.h:34: error: conflicting types for 'uartSetBaudRate'
uart.h:177: error: previous declaration of 'uartSetBaudRate' was here
SoR_Utils.h:35: warning: data definition has no type or storage class
SoR_Utils.h:35: warning: type defaults to 'int' in declaration of 'rprintfInit'
SoR_Utils.h:35: warning: parameter names (without types) in function declaration
SoR_Utils.h:35: error: conflicting types for 'rprintfInit'
rprintf.h:69: error: previous declaration of 'rprintfInit' was here
make: *** [Photovore_v1.o] Error 1
Build failed with 7 errors and 9 warnings...