Elektroda.pl
Elektroda.pl
X
Please add exception to AdBlock for elektroda.pl.
If you watch the ads, you support portal and users.

[WinAVR] Błąd prawdopodobnie w pliku makefile

grzece 27 Jun 2009 15:07 2998 1
  • #1
    grzece
    Level 15  
    Mam dziwny problem ze skompilowaniem prostego programu co jest spowodowane prawdopodobnie złym plikiem Makefile( kto ten absurdalny plik wymyslił?). Jednego dnia się kompiluje po odnowieniu za pomocą Mfile z Winavr już nie. Projekt zawiera tylko jeden plik a.c. Kod programu:
    #include <avr/io.h>
    #include <avr/interrupt.h>
    
    int main (void)
    {
    
       DDRB = 0xFF; // Portb jako wyjscie
       DDRD |= (1 << 7); // Pin D7 wyjscie
       PORTB |= (1 << 1); // 3,4 EN wlaczone
       PORTB |= (1 << 2); //1,2 EN wlaczone
       PORTB &= ~(1 << 3); // 3A wylaczone
       PORTB |= (1 << 4); // 1A wlaczone
       PORTB &= ~(1 << 5); // 2A wylaczone
       PORTD |= (1 << 7); // 4A wlaczone
     
       for (;;)
       {	
    		
       }
    }
    

    Output w winavr:
    > "make.exe" all
    
    -------- 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 C: a.c
    avr-gcc -c -mmcu=atmega8 -I. -gdwarf-2 -DF_CPU=1000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./a.lst  -std=gnu99 -MMD -MP -MF .dep/a.o.d a.c -o a.o 
    a.c:20: fatal error: opening dependency file .dep/a.o.d: No such file or directory
    compilation terminated.
    make.exe: *** [a.o] Error 1
    
    > Process Exit Code: 2
    > Time Taken: 00:00

    Początkowa część Makefile:
    
    # MCU name
    MCU = atmega8
    
    
    # Processor frequency.
    #     This will define a symbol, F_CPU, in all source code files equal to the 
    #     processor frequency. You can then use this symbol in your source code to 
    #     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
    #     automatically to create a 32-bit value in your source code.
    #     Typical values are:
    #         F_CPU =  1000000
    #         F_CPU =  1843200
    #         F_CPU =  2000000
    #         F_CPU =  3686400
    #         F_CPU =  4000000
    #         F_CPU =  7372800
    #         F_CPU =  8000000
    #         F_CPU = 11059200
    #         F_CPU = 14745600
    #         F_CPU = 16000000
    #         F_CPU = 18432000
    #         F_CPU = 20000000
    F_CPU = 1000000
    
    
    # Output format. (can be srec, ihex, binary)
    FORMAT = ihex
    
    
    # Target file name (without extension).
    TARGET = a
    
    
    # Object files directory
    #     To put object files in current directory, use a dot (.), do NOT make
    #     this an empty or blank macro!
    OBJDIR = .
    
    
    # List C source files here. (C dependencies are automatically generated.)
    SRC = $(TARGET).c
    
    
    # List C++ source files here. (C dependencies are automatically generated.)
    CPPSRC = 
    
    
    # List Assembler source files here.
    #     Make them always end in a capital .S.  Files ending in a lowercase .s
    #     will not be considered source files but generated files (assembler
    #     output from the compiler), and will be deleted upon "make clean"!
    #     Even though the DOS/Win* filesystem matches both .s and .S the same,
    #     it will preserve the spelling of the filenames, and gcc itself does
    #     care about how the name is spelled on its command-line.
    ASRC =
    
    
    # Optimization level, can be [0, 1, 2, 3, s]. 
    #     0 = turn off optimization. s = optimize for size.
    #     (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
    OPT = s

    Czy jest ktoś mi w stanie powiedzieć o co mu chodzi?



    EDIT:
    A wiec po wywaleniu ponizszych linijek z Makefile:
    # Compiler flags to generate dependency files.
    GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
    oraz
    $(REMOVEDIR) .dep
    nastapiła zmiana błędu. Natomiast jeszcze po zmianie linijki:
    SRC = $(TARGET).c
    na poszło bez błędu. Prawie bo się skompilowało, ale w trakcie coś takiego wypisało: /usr/bin/sh: avr-objcopy: command not found

    Size after:
    /usr/bin/sh: avr-size: command not found

    Może mi ktoś teraz wytłumaczyć dlaczego program Mfile jest zintegrowany z WinAVR, a z nim nie współpracuje, czym są dependency files i o co w tym chodzi?
  • #2
    maly_elektronik
    Level 23  
    Coś kolega przesadnie kombinuje z tym Makefile'm :)
    Wygenerowany kod musi być poprawny bo wielu ludzi korzysta z tego generatora :) Spróbuj przeinstalować na nowo WinAVRa może to naprawi problem :)
    Poniżej przykładowy działający makefile (oczywiście pliki tego typu nie nadają się do operacji CTRL+C -> CTRL+V)


    Pozdrawiam maly_elektronik

    Ten przydługi przykład, zamieniłem na załącznik.
    [zumek]