Zu blöd zum avr-gcc einrichten?

Feb 12, 2007 11 Replies

Hallo allerseits,



ich bin gerade dabei mir avr-gcc einzurichten, nach dieser Anleitung:

formatting link



Hier rennt ArchLinux mit nem aktuellen Kernel, der Rest ist auch up to date.



$PATH ist entsprechend erweitert.



binutils und avr-gcc-core habe ich genau nach Anleitung (incl. identischer Pfade) installiert, keine Probleme.



Danach habe ich mir die avr-libc vorgenommen. Da scheint obige Anleitung nicht ganz aktuell zu sein, da die mitgelieferte INSTALL was anderes sagt:



./configure --build=`./config.guess` --host=avr [other options]



Ok, also noch den Zielpfad angepasst und los: ../configure --prefix=/usr/local/avr --build=`./config.guess` --host=avr



Lief auch soweit sauber durch incl. install.



Danach habe ich mir das Sample blink.c incl. Makefile von obiger Seite kopiert und versuche es zu übersetzen:



[root@laptop Blinker]# ls -l insgesamt 8

-rw-r--r-- 1 naumannu users 511 12. Feb 21:07 Makefile



-rw-r--r-- 1 naumannu users 584 12. Feb 20:36 blink.c [root@laptop Blinker]# make make: *** Keine Regel vorhanden, um das Target »blink.out«, benötigt von »blink.hex«, zu erstellen. Schluss. [root@laptop Blinker]#



Peng, nix geht. Hat jemand ne Idee wo genau mein Problem liegt?



Hier nochmal die Makefile, sollte aber passen (incl. Tabs): TARGET = blink MCU = attiny2313 CC = avr-gcc OBJCOPY=avr-objcopy CFLAGS =-g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologues



-save-temps -fno-common



all: $(TARGET).hex



$(TARGET).hex : $(TARGET).out $(OBJCOPY) -j .data -j .text -O ihex $@ $^



$(TARGET).elf: $(TARGET).o $(CC) $(CFLAGS) -o $@ -Wl,-Map,$(TARGET).map $^



$(TARGET).o : $(TARGET).c $(CC) $(CFLAGS) -c $^



load: $(TARGET).hex avrdude -p t2313 -c avr910 -U flash:w:$(TARGET).hex -v



clean: rm -f *.o *.map *.elf *.hex *.s *.i


Gruss Uwe --------- cut here with a very sharp knife --------- Uwe Naumann eMail: uwe[at]vieledinge[dot]de Web: http://www.vieledinge.de http://www.swllog.de

|> Hier nochmal die Makefile, sollte aber passen (incl. Tabs):

Nein, tut nicht ;-)

|> $(TARGET).hex : $(TARGET).out

Wer erzeugt das blink.out? Sollte doch wohl eher $(TARGET).elf sein...

Georg Acher, acher@in.tum.de http://www.lrr.in.tum.de/~acher "Oh no, not again !" The bowl of petunias

Sollte das oben nicht "$(TARGET).hex : $(TARGET).elf" heissen? Wo hast du dieses Makefile her?

MFG Gernot

Am Mon, 12 Feb 2007 21:13:53 +0000 schrieb Gernot Fink:

Geht zumindest schon mal weiter ;-)

Siehe der gepostete Link. Schade das in solchen Einsteiger-Anleitungen immer wieder gravierende Bugs drin sind. Ich bin zwar mittlerweile recht intensiv seit ca. 12 Jahren auf Unix- und Linuxsystemen unterwegs, habe aber eigentlich mit C-Programmierung incl. dem ganzen Compiler- und Make-Gedöns bisher nix am Hut. C interessiert mich als Hochsprache für die AVRs, da ASM doch nicht das ist womit ich all meine Projekte machen will. Und sonst bin ich eher mit anderen, µC-untypischen Sprachen (Java, VB) unterwegs.

Da muss noch ein Bug sein:

avr-objcopy -j .data -j .text -O ihex blink.hex blink.elf avr-objcopy: 'blink.hex': No such file avr-objcopy: error: the input file 'blink.hex' is empty make: *** [blink.hex] Fehler 1

Hast Du vielleicht mal eine kleine, funktionierende Makefile als Sample für mich?

Danke schon mal für Deine Mühen.

Gruss Uwe --------- cut here with a very sharp knife --------- Uwe Naumann eMail: uwe[at]vieledinge[dot]de Web: http://www.vieledinge.de http://www.swllog.de

Am Mon, 12 Feb 2007 21:03:08 +0000 schrieb Georg Acher:

Ok, überredet ;-)

Hilft schon mal weiter, siehe auch meine andere Antwort...

Danke erst mal.

Gruss Uwe --------- cut here with a very sharp knife --------- Uwe Naumann eMail: uwe[at]vieledinge[dot]de Web: http://www.vieledinge.de http://www.swllog.de

TARGET = blink MCU = attiny2313 CC = avr-gcc OBJCOPY=avr-objcopy CFLAGS =-g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologues

-save-temps -fno-common

all: $(TARGET).hex

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

$(TARGET).elf: $(TARGET).o $(CC) $(CFLAGS) -o $@ -Wl,-Map,$(TARGET).map $^

$(TARGET).o : $(TARGET).c $(CC) $(CFLAGS) -c $^

load: $(TARGET).hex avrdude -p t2313 -c avr910 -U flash:w:$(TARGET).hex -v

clean: rm -f *.o *.map *.elf *.hex *.s *.i

|> >> $(OBJCOPY) -j .data -j .text -O ihex $@ $^ |> |> Da muss noch ein Bug sein: |> |> avr-objcopy -j .data -j .text -O ihex blink.hex blink.elf |> avr-objcopy: 'blink.hex': No such file |> avr-objcopy: error: the input file 'blink.hex' is empty |> make: *** [blink.hex] Fehler 1

Laut objcopy-help soll das so sein:

Usage: objcopy [option(s)] in-file [out-file]

Also $(OBJCOPY) -j .data -j .text -O ihex $^ $@

Georg Acher, acher@in.tum.de http://www.lrr.in.tum.de/~acher "Oh no, not again !" The bowl of petunias

Schon besser. Hier hab ich aber:

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

MFG Gernot

Uwe Naumann schrieb:

Vielleicht willst du ja Mfile benutzen. Hab's zwar auch schon lange nicht mehr aktualisiert, aber es sollte dier zumindest für den Anfang mit den Makefiles helfen (sofern du ein Tcl/Tk hast):

formatting link

cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)

Am Mon, 12 Feb 2007 23:28:03 +0100 schrieb Michael Roth:

Danke, das tuts. Ich werde mich wohl mal etwas tiefer in Makefiles einarbeiten müssen.

Gruss Uwe --------- cut here with a very sharp knife --------- Uwe Naumann eMail: uwe[at]vieledinge[dot]de Web: http://www.vieledinge.de http://www.swllog.de

Am Mon, 12 Feb 2007 22:45:07 +0000 schrieb Georg Acher:

Ja, so langsam wirds. Danke.

Gruss Uwe --------- cut here with a very sharp knife --------- Uwe Naumann eMail: uwe[at]vieledinge[dot]de Web: http://www.vieledinge.de http://www.swllog.de

Am Tue, 13 Feb 2007 16:03:40 +0000 schrieb Joerg Wunsch:

Werde ich mir auf alle Fälle mal ansehen. Wobei ich eigentlich Wrapper um reine Text-Config-Files nicht so recht mag.

Gruss Uwe --------- cut here with a very sharp knife --------- Uwe Naumann eMail: uwe[at]vieledinge[dot]de Web: http://www.vieledinge.de http://www.swllog.de

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required