Próbowałem z Programmer's Notepad z WinAvr na prostym programie:
#include <avr/io.h> // dostęp do rejestrów
int main( void ) // program główny
{
sbi(DDRD,4); // użyj linii PD4 jako wyjścia
sbi(PORTD,3); // "podciągnij" do logicznej 1 linię PD3
while(1) // pętla nieskończona
{
cbi(PORTD,4); // zapal diodę LED podłączoną do linii PD4
loop_until_bit_is_clear(PIND,3); // czekaj na naciśnięcie przycisku na PD3
sbi(PORTD,4); // zgaś diodę LED podłączoną do linii PD4
loop_until_bit_is_clear(PIND,3); // czekaj na naciśnięcie przycisku na PD3
}
}
Ale za każdym razem otrzymuje błędy:
> "make.exe" all
-------- begin --------
avr-gcc (GCC) 4.1.2 (WinAVR 20070525)
Copyright (C) 2006 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: test.c
avr-gcc -c -mmcu=attiny2313 -I. -gdwarf-2 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./test.lst -std=gnu99 -Wundef -MMD -MP -MF .dep/test.o.d test.c -o test.o
test.c: In function 'main':
test.c:5: warning: implicit declaration of function 'sbi'
test.c:10: warning: implicit declaration of function 'cbi'
test.c:15:2: warning: no newline at end of file
Linking: test.elf
avr-gcc -mmcu=attiny2313 -I. -gdwarf-2 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=test.o -std=gnu99 -Wundef -MMD -MP -MF .dep/test.elf.d test.o --output test.elf -Wl,-Map=test.map,--cref -lm
test.o: In function `main':
C:\Documents and Settings\Piotr\Moje dokumenty\test2/test.c:4: undefined reference to `sbi'
C:\Documents and Settings\Piotr\Moje dokumenty\test2/test.c:6: undefined reference to `sbi'
C:\Documents and Settings\Piotr\Moje dokumenty\test2/test.c:10: undefined reference to `cbi'
C:\Documents and Settings\Piotr\Moje dokumenty\test2/test.c:12: undefined reference to `sbi'
make.exe: *** [test.elf] Error 1
> Process Exit Code: 2
> Time Taken: 00:04
Z plikiem makefile jest napewno ok. Już nie wiem co robie źle. Zastanawiałem sie czy moze nalezy skopiowac pliki z nagłówka do folderu z programem ale to tez nie pomaga.
I mam jeszcze pytanie czy chcąc używać AVR Studio musze skopiowac biblioteki z WinAvr w inne miejsce aby móc sie do nich odwoływać? Mam ich w standardowym miejscu po zainstalowaniu WinAVR. Bede wdzieczny za jaka kolwiek pomoc.