Hallo,
möchte die uart.h von fleury einbinden...leider meckert mein compiler
rum das er die funktionen nicht findet.
die uart.h ist aber eingebunden und wird vom linker auch gefunden ( wenn
ich die auskommentier dann kommen noch mehr Fehler).
Hier mal mein code:
1 |
|
2 | #include <avr/io.h>
|
3 | #include <util/delay.h>
|
4 | #include <avr/interrupt.h>
|
5 | #include "uart.h"
|
6 |
|
7 | //define CPU frequency in Mhz here if not defined in Makefile
|
8 | #ifndef F_CPU
|
9 | #define F_CPU 8000000UL
|
10 | #endif
|
11 |
|
12 | //9600 baud
|
13 | #define UART_BAUD_RATE 9600
|
14 |
|
15 |
|
16 | int time =50;
|
17 | ISR(INT0_vect) // Aktion bei Interrupt Timer0
|
18 | {
|
19 | time= 20;
|
20 |
|
21 | }
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | int main (void)
|
28 | {
|
29 | DDRD = 0b01100010;//POrtD.1 , POrtD.6 und portD.7 auf Ausgang, rest von PortD auf Eingang
|
30 |
|
31 | // UART initialisieren
|
32 |
|
33 | uart_init( UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU) );
|
34 |
|
35 |
|
36 | //Konfig Timer0
|
37 |
|
38 | TCCR0 = (1<<CS00)|(1<<CS01) |(1<<CS02); //Externer Pin TO, steigende Flanke
|
39 |
|
40 | sei(); // schaltet global Interrupts ein
|
41 |
|
42 |
|
43 | while(1)
|
44 | {
|
45 |
|
46 | _delay_ms(time);
|
47 | PORTD = 0b01000000;// LED 2 ist an
|
48 | _delay_ms(time);
|
49 | PORTD = 0b00100000;// LED 1 ist an
|
50 |
|
51 | //an uart senden
|
52 |
|
53 | uart_puts("String stored in SRAM\n");
|
54 |
|
55 | _delay_ms(1000);
|
56 | }
|
57 | return 0;
|
58 | }
|
Und hier der Fehler vom compiler:
1 | -------- begin --------
|
2 | avr-gcc (WinAVR 20100110) 4.3.3
|
3 | Copyright (C) 2008 Free Software Foundation, Inc.
|
4 | This is free software; see the source for copying conditions. There is NO
|
5 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
6 |
|
7 |
|
8 | Compiling C: main.c
|
9 | avr-gcc -c -mmcu=atmega8 -I. -gdwarf-2 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./main.lst -std=gnu99 -MMD -MP -MF .dep/main.o.d main.c -o main.o
|
10 |
|
11 | Linking: main.elf
|
12 | avr-gcc -mmcu=atmega8 -I. -gdwarf-2 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=main.o -std=gnu99 -MMD -MP -MF .dep/main.elf.d main.o --output main.elf -Wl,-Map=main.map,--cref -lm
|
13 | main.o: In function `main':
|
14 | O:\TEE20T\PoA 2012\AVR\AVR GCC\test uart/main.c:34: undefined reference to `uart_init'
|
15 | O:\TEE20T\PoA 2012\AVR\AVR GCC\test uart/main.c:54: undefined reference to `uart_puts'
|
16 | make.exe: *** [main.elf] Error 1
|
17 |
|
18 | > Process Exit Code: 2
|
19 | > Time Taken: 00:01
|
Hoffe ihr könnt mir sagen warum er die "uart_puts" und die "uart_init"
nicht findet.
MFG