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

Jak skonfigurować makefile dla AVR GCC i Atmega8535?

lukole 27 Lip 2006 23:06 2296 3
REKLAMA
  • #1 2857400
    lukole
    Poziom 10  
    Posty: 41
    Ocena: 1
    Witam. Siłuję sie z C i GCC dla AVR. Mam pytania odnośnie pliku makefile

    1. wobec atmego8535, czy wymaga on jakiejs specjalnej modyfikacji poza podaniem Mcu name jako atmega8535??

    2. Czy jest jakies narzędzie do jego weryfikacji - gdy sobie zmienie mcu name na jakas bzdurna nazwe to sie nic nie dzieje przy kompilacji kodu??

    plik makefile kopiuje do katalogu projektu

    Pytam bo nie chce mi ruszyc moj program i teraz sie skupilem na tym makefile.

    Dzięki i pozdrawiam
  • REKLAMA
  • #2 2857478
    Procekk
    Poziom 12  
    Posty: 77
    Pomógł: 3
    Jeśli wcześniejszy projekt ruszył na tym pliku makefile, tylko z inną wartością mcu_target to nie powinno być problemów. W załączniku masz makefile jakiegos projektu na atmega8515, zamień 15 na 35 i powinno dziabać.

    Zobacz sobie plik mfile.tcl w WinAVR/mfile/ jest tam lista procesorków, jeśli wpiszesz coś z poza tej listy, kompilator wyrzuci serię blędów.

    ---------------- coś mi dodawanie załączników nie chce działać :|
    PRG = projekt.c
    OBJ = projekt.o
    MCU_TARGET = atmega8535
    OPTIMIZE = -O2

    DEFS =
    LIBS =

    # You should not have to change anything below here.

    CC = avr-gcc

    # Override is only needed by avr-lib build system.

    override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
    override LDFLAGS = -Wl,-Map,$(PRG).map

    OBJCOPY = avr-objcopy
    OBJDUMP = avr-objdump

    all: $(PRG).elf lst text eeprom

    $(PRG).elf: $(OBJ)
    $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

    clean:
    rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak
    rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)

    lst: $(PRG).lst

    %.lst: %.elf
    $(OBJDUMP) -h -S $< > $@

    # Rules for building the .text rom images

    text: hex bin srec

    hex: $(PRG).hex
    bin: $(PRG).bin
    srec: $(PRG).srec

    %.hex: %.elf
    $(OBJCOPY) -j .text -j .data -O ihex $< $@

    %.srec: %.elf
    $(OBJCOPY) -j .text -j .data -O srec $< $@

    %.bin: %.elf
    $(OBJCOPY) -j .text -j .data -O binary $< $@

    # Rules for building the .eeprom rom images

    eeprom: ehex ebin esrec

    ehex: $(PRG)_eeprom.hex
    ebin: $(PRG)_eeprom.bin
    esrec: $(PRG)_eeprom.srec

    %_eeprom.hex: %.elf
    $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@

    %_eeprom.srec: %.elf
    $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@

    %_eeprom.bin: %.elf
    $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@

    # Every thing below here is used by avr-libc's build system and can be ignored
    # by the casual user.

    FIG2DEV = fig2dev
    EXTRA_CLEAN_FILES = *.hex *.bin *.srec

    dox: eps png pdf

    eps: $(PRG).eps
    png: $(PRG).png
    pdf: $(PRG).pdf

    %.eps: %.fig
    $(FIG2DEV) -L eps $< $@

    %.pdf: %.fig
    $(FIG2DEV) -L pdf $< $@

    %.png: %.fig
    $(FIG2DEV) -L png $< $@
  • REKLAMA
  • #3 2858153
    lukole
    Poziom 10  
    Posty: 41
    Ocena: 1
    No niestety nie ruszył na tym. Dodam, że jest to mój pierwszy projekt i nigdy nie testowałem mojego Makefile. W ramach testów wpisywałem w mcu name np. kwiatek :D a kompilator nie reagował na to jakby tego pliku w ogole nie czytał.

    avr_gcc mam skonfigurowany tak jak to opisywali w kursie w EdW, czyli zrezygnowałem z domyslnego ustawiania systemowego PATH, a stworzyłem odpowiednie pliki wsadowe dla make.exe i make clean

    Dodano po 4 [minuty]:

    oto poczatkowa sekcja mojego pliku z MCU jako kwiatek :D

    # Hey Emacs, this is a -*- makefile -*-
    #----------------------------------------------------------------------------
    # WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
    #
    # Released to the Public Domain
    #
    # Additional material for this makefile was written by:
    # Peter Fleury
    # Tim Henigan
    # Colin O'Flynn
    # Reiner Patommel
    # Markus Pfaff
    # Sander Pool
    # Frederik Rouleau
    # Carlos Lamas
    #
    #----------------------------------------------------------------------------
    # On command line:
    #
    # make all = Make software.
    #
    # make clean = Clean out built project files.
    #
    # make coff = Convert ELF to AVR COFF.
    #
    # make extcoff = Convert ELF to AVR Extended COFF.
    #
    # make program = Download the hex file to the device, using avrdude.
    # Please customize the avrdude settings below first!
    #
    # make debug = Start either simulavr or avarice as specified for debugging,
    # with avr-gdb or avr-insight as the front end for debugging.
    #
    # make filename.s = Just compile filename.c into the assembler code only.
    #
    # make filename.i = Create a preprocessed source file for use in submitting
    # bug reports to the GCC project.
    #
    # To rebuild project do "make clean" then "make all".
    #----------------------------------------------------------------------------


    # MCU name
    MCU = kwiatek


    # 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 = 8000000


    # Output format. (can be srec, ihex, binary)
    FORMAT = ihex


    # Target file name (without extension).
    TARGET = modul_LCD


    # List C source files here. (C dependencies are automatically generated.)
    SRC = $(TARGET).c


    # 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


    # Debugging format.
    # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
    # AVR Studio 4.10 requires dwarf-2.
    # AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
    DEBUG = dwarf-2


    no i z tym projekt sie kompiluje, za to jeśli zmienie nazwe np. target, no to wtedy już się na to nie godzi, więc jednak go czyta
  • #4 2866413
    lukole
    Poziom 10  
    Posty: 41
    Ocena: 1
    zainstalowałem winAVR-a z ustawieniem sciezek PATH w systemie, a nie jak opisywano w kursie EdW poprzez pliki wsadowe, plik Makefile stworzylem w programie Mfile WinAVR. Teraz kompilator reaguje na niego prawidłowo
REKLAMA