logo elektroda
logo elektroda
X
logo elektroda
REKLAMA
REKLAMA
Adblock/uBlockOrigin/AdGuard mogą powodować znikanie niektórych postów z powodu nowej reguły.

[WinAVR] [C] Kompilacja gotowego projektu

mlassota 02 Mar 2011 21:35 3579 7
REKLAMA
  • #1 9227545
    mlassota
    Poziom 18  
    Szanowni Koledzy
    Postanowiłem zbudować licznik częstotliwości ze strony.
    O ile ze zrozumieniem schematu nie maiłem żadnego problemu o tyle mam problem z kompilacją programu do procesora. WinAVR wywala niesamowitą ilość błędów. Plik Counter.c pobrałem ze strony projektu.
    Czy ktoś mógłby mi pomóc w kompilacji tego programu?

    W załącznikach plik Counter.c i Make.
    Przeczytałem kursy kompilacji w C lecz samego C niestety jeszcze nie znam (do tej pory bawię się Bascom'em...)
    Będę wdzięczny za pomoc
    Poniżej log z WinAVR


    > 
    "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: counter.c
    avr-gcc -c -mmcu=attiny2313 -I. -gdwarf-2 -DF_CPU=4000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./counter.lst  -std=gnu99 -MMD -MP -MF .dep/counter.o.d counter.c -o counter.o 
    counter.c:45:16: warning: io.h: No such file or directory
    counter.c:46:20: warning: signal.h: No such file or directory
    counter.c:47:23: warning: interrupt.h: No such file or directory
    counter.c:70:1: warning: "F_CPU" redefined
    <command line>:1:1: warning: this is the location of the previous definition
    counter.c:121: warning: return type defaults to 'int'
    counter.c:121: warning: function declaration isn't a prototype
    counter.c: In function 'SIGNAL':
    counter.c:121: warning: type of 'SIG_OVERFLOW0' defaults to 'int'
    counter.c:125: warning: implicit declaration of function 'outp'
    counter.c:125: error: 'TCNT0' undeclared (first use in this function)
    counter.c:125: error: (Each undeclared identifier is reported only once
    counter.c:125: error: for each function it appears in.)
    counter.c:128: warning: implicit declaration of function 'inp'
    counter.c:128: error: 'PORTB' undeclared (first use in this function)
    counter.c:149: error: 'PORTD' undeclared (first use in this function)
    counter.c: In function 'read_counters':
    counter.c:186: warning: implicit declaration of function 'cli'
    counter.c:189: error: 'PORTB' undeclared (first use in this function)
    counter.c:192: error: 'DDRB' undeclared (first use in this function)
    counter.c:195: error: 'DDRD' undeclared (first use in this function)
    counter.c:199: warning: implicit declaration of function 'cbi'
    counter.c:199: error: 'PORTD' undeclared (first use in this function)
    counter.c:199: error: 'PD5' undeclared (first use in this function)
    counter.c:201: warning: implicit declaration of function 'sbi'
    counter.c:207: error: 'PINB' undeclared (first use in this function)
    counter.c:209: error: 'PIND' undeclared (first use in this function)
    counter.c:218: error: 'PD4' undeclared (first use in this function)
    counter.c:240: warning: implicit declaration of function 'sei'
    counter.c: In function 'capture':
    counter.c:251: error: 'PORTD' undeclared (first use in this function)
    counter.c:251: error: 'PD6' undeclared (first use in this function)
    counter.c:255: error: 'TCNT1H' undeclared (first use in this function)
    counter.c:256: error: 'TCNT1L' undeclared (first use in this function)
    counter.c:258: error: 'OCR1H' undeclared (first use in this function)
    counter.c:259: error: 'OCR1L' undeclared (first use in this function)
    counter.c:261: error: 'TCCR1A' undeclared (first use in this function)
    counter.c:263: error: 'TIFR' undeclared (first use in this function)
    counter.c:263: error: 'OCF1A' undeclared (first use in this function)
    counter.c:266: error: 'TCCR1B' undeclared (first use in this function)
    counter.c:270: warning: implicit declaration of function 'BV'
    counter.c: In function 'main':
    counter.c:297: error: 'DDRB' undeclared (first use in this function)
    counter.c:300: error: 'PORTB' undeclared (first use in this function)
    counter.c:304: error: 'DDRD' undeclared (first use in this function)
    counter.c:307: error: 'PORTD' undeclared (first use in this function)
    counter.c:312: error: 'TCCR0' undeclared (first use in this function)
    counter.c:316: error: 'TIMSK' undeclared (first use in this function)
    counter.c:316: error: 'TOIE0' undeclared (first use in this function)
    counter.c:344: error: 'TCNT1H' undeclared (first use in this function)
    counter.c:345: error: 'TCNT1L' undeclared (first use in this function)
    counter.c:347: error: 'OCR1H' undeclared (first use in this function)
    counter.c:348: error: 'OCR1L' undeclared (first use in this function)
    counter.c:350: error: 'TCCR1A' undeclared (first use in this function)
    counter.c:353: error: 'TCCR1B' undeclared (first use in this function)
    counter.c:354: error: 'TIFR' undeclared (first use in this function)
    counter.c:354: error: 'OCF1A' undeclared (first use in this function)
    make.exe: *** [counter.o] Error 1
    
    > Process Exit Code: 2
    > Time Taken: 00:01


    Proszę, zgodnie z regulaminem pkt 11.1, o usunięcie słów PROBLEM lub/i POMOC z tytułu. Prośba dotyczy także wszelkich wariacji typu: kłopot, pomocy, problemy itd.
  • REKLAMA
  • Pomocny post
    #2 9227728
    tomgart
    Poziom 25  
    Brakuje plików w projekcie:
    io.h
    signal.h
    interrupt.h

    Sprawdź scieżkę dostępu do tych plików nagłówkowych.
    Ew spójrz: Link
  • REKLAMA
  • #3 9227872
    mlassota
    Poziom 18  
    Zanim odczytałem post doszedłem do tego i skopiowałem "załączone" 3 pliki i dostałem informacje:

    "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: counter.c 
    avr-gcc -c -mmcu=attiny2313 -I. -gdwarf-2 -DF_CPU=4000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./counter.lst  -std=gnu99 -MMD -MP -MF .dep/counter.o.d counter.c -o counter.o 
    In file included from counter.c:46: 
    ./signal.h:36:2: warning: #warning "This header file is obsolete.  Use ." 
    counter.c:70:1: warning: "F_CPU" redefined 
    :1:1: warning: this is the location of the previous definition 
    counter.c: In function '__vector_6': 
    counter.c:125: warning: implicit declaration of function 'outp' 
    counter.c:128: warning: implicit declaration of function 'inp' 
    counter.c: In function 'read_counters': 
    counter.c:199: warning: implicit declaration of function 'cbi' 
    counter.c:201: warning: implicit declaration of function 'sbi' 
    counter.c: In function 'capture': 
    counter.c:270: warning: implicit declaration of function 'BV' 
    counter.c: In function 'main': 
    counter.c:312: error: 'TCCR0' undeclared (first use in this function) 
    counter.c:312: error: (Each undeclared identifier is reported only once 
    counter.c:312: error: for each function it appears in.) 
    make.exe: *** [counter.o] Error 1 
    
    > Process Exit Code: 2 
    > Time Taken: 00:01 


    Krócej ale wciąż z jakimiś błędami.
    Próbowałem dodać ścieżkę do właściwości WIN7 ale to nie daje żadnego skutku...
  • #4 9227942
    janbernat
    Poziom 38  
    (WinAVR 20070525)
    To jednak 4 lata.
    outp, inp teraz już nie ma.
    Po za tym podejrzewam z prawdopodobieństwem graniczącym z pewnością że jest Atiny2313 a nie At90s2313.
  • REKLAMA
  • #6 9228045
    mlassota
    Poziom 18  
    Nawet po zmianie na 90s2313 w Make wywala całą litanie fioletowych
    C:\t/counter.c:199: undefined reference to `cbi'
    C:\t/counter.c:201: undefined reference to `sbi'


    Czy Tiny nie jest następcą tego 90s?
    Wiem że jak kompilowałem programy w Bascom używając deklaracji 90s wszystko działało stąd taka deklaracja w Make.
  • Pomocny post
    #7 9228118
    tomgart
    Poziom 25  
    cbi sbi to odpowiednio makra ustawiające bity, nie ma ich już w nowym avr-gcc od kilku lat i to dlatego. Komunikat o tym wyrzucało Ci już poprzednio.
    Spójrz:Link

    Generalnie są dwa wyjścia:
    1) Jakieś stare avr-gcc. Skompilujesz, wgrasz do procesora i po sprawie.
    2) Pozmieniać wszystkie deklaracje sbi, cbi (set bit, clear bit) na nową modłę, czyli _BV (bit value)
  • REKLAMA
  • #8 9228544
    mlassota
    Poziom 18  
    Skorzystałem ze sposobu 1 tzn. avr-gcc z 2002r. i kompilacja z wiersza poleceń. Niestety ten avr-gcc nie obsługuje attiny2313 (tzn. obsługuje tylko w trybie asembler'a) więc zadeklarowałem 90s. kompilacja przebiegła bez błędów. Po wgraniu do attiny - program ruszył i działa... (będą jeszcze testy ale chyba wszystko w porządku)
    Dziękuję za pomoc!
REKLAMA