Witam
Mam problem z kompilacją programu już na samym podstawowym etapie jego pisania:
#define F_CPU 1000000L
#include <avr/io.h>
#include <util/delay.h>
/******************************************************
Definicje stałych
*******************************************************/
#define F_CPU 1000000 /* 1MHz zegar procesora */
/**************************************************************
Koniec definicji stałych
**************************************************************/
//definiujemy stany portu sterujacego dioda LED
#define LED_ON sbi(DDRB,PB1)
#define LED_OFF cbi(DDRB,PB1)
Potem w programie głównym mam wywołanie LED_ON i OFF i tyle dla testów a wynik kompilacji taki:
> "make.exe" all
-------- begin --------
avr-gcc (WinAVR 20100110) 4.3.3
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 C: LED.c
avr-gcc -c -mmcu=atmega16 -I. -gdwarf-2 -DF_CPU=1000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./LED.lst -std=gnu99 -MMD -MP -MF .dep/LED.o.d LED.c -o LED.o
LED.c:1:1: warning: "F_CPU" redefined
<command-line>: warning: this is the location of the previous definition
LED.c:11:1: warning: "F_CPU" redefined
LED.c:1:1: warning: this is the location of the previous definition
LED.c: In function 'main':
LED.c:25: warning: implicit declaration of function 'sbi'
LED.c:27: warning: implicit declaration of function 'cbi'
Linking: LED.elf
avr-gcc -mmcu=atmega16 -I. -gdwarf-2 -DF_CPU=1000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=LED.o -std=gnu99 -MMD -MP -MF .dep/LED.elf.d LED.o --output LED.elf -Wl,-Map=LED.map,--cref -lm
LED.o: In function `main':
C:\kurs_avrgcc\01/LED.c:25: undefined reference to `sbi'
C:\kurs_avrgcc\01/LED.c:27: undefined reference to `cbi'
make.exe: *** [LED.elf] Error 1
> Process Exit Code: 2
> Time Taken: 00:01
Dlaczego nie mogę używać sbi oraz cbi?
Mam problem z kompilacją programu już na samym podstawowym etapie jego pisania:
#define F_CPU 1000000L
#include <avr/io.h>
#include <util/delay.h>
/******************************************************
Definicje stałych
*******************************************************/
#define F_CPU 1000000 /* 1MHz zegar procesora */
/**************************************************************
Koniec definicji stałych
**************************************************************/
//definiujemy stany portu sterujacego dioda LED
#define LED_ON sbi(DDRB,PB1)
#define LED_OFF cbi(DDRB,PB1)
Potem w programie głównym mam wywołanie LED_ON i OFF i tyle dla testów a wynik kompilacji taki:
> "make.exe" all
-------- begin --------
avr-gcc (WinAVR 20100110) 4.3.3
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 C: LED.c
avr-gcc -c -mmcu=atmega16 -I. -gdwarf-2 -DF_CPU=1000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./LED.lst -std=gnu99 -MMD -MP -MF .dep/LED.o.d LED.c -o LED.o
LED.c:1:1: warning: "F_CPU" redefined
<command-line>: warning: this is the location of the previous definition
LED.c:11:1: warning: "F_CPU" redefined
LED.c:1:1: warning: this is the location of the previous definition
LED.c: In function 'main':
LED.c:25: warning: implicit declaration of function 'sbi'
LED.c:27: warning: implicit declaration of function 'cbi'
Linking: LED.elf
avr-gcc -mmcu=atmega16 -I. -gdwarf-2 -DF_CPU=1000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=LED.o -std=gnu99 -MMD -MP -MF .dep/LED.elf.d LED.o --output LED.elf -Wl,-Map=LED.map,--cref -lm
LED.o: In function `main':
C:\kurs_avrgcc\01/LED.c:25: undefined reference to `sbi'
C:\kurs_avrgcc\01/LED.c:27: undefined reference to `cbi'
make.exe: *** [LED.elf] Error 1
> Process Exit Code: 2
> Time Taken: 00:01
Dlaczego nie mogę używać sbi oraz cbi?