# Makefile für Doppel-Servo-Steuerung mit ATtiny13
PROJECT = servo2
OBJECTS = main.o
DEVICE = attiny13
F_CPU = 819200
# Compilerschalter
CFLAGS = -DF_CPU=$(F_CPU) -Os -ffunction-sections -Wall -Wno-parentheses
# Linkerschalter
LDFLAGS = -Wl,--relax -Wl,--gc-sections
CC = avr-gcc -mmcu=$(DEVICE)
OHEX = avr-objcopy -O ihex
DUMP = avr-objdump -d
SIZE = avr-size --mcu=$(DEVICE)
all: $(PROJECT).hex $(PROJECT).lst
# Compile+link: „Ausführbare“ Datei generieren
%.o: %.S Makefile
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.cpp Makefile
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
%.elf: $(OBJECTS)
$(CC) $(LDFLAGS) $^ -o $@
$(SIZE) $@
# Datei für das Programmierprogramm erzeugen
%.hex: %.elf
$(OHEX) -j .text -j .data -j .eeprom -j .fuse -j .signature $< $@
# $(OHEX) -j .text -j .signature $< $@
# Listing-Datei generieren
%.lst: %.elf
$(DUMP) $< > $@
# Chip-Programmierung
program:
avrpp -8 -ff $(PROJECT).hex
flash: $(PROJECT).hex
avrpp -8 $<
# Projektverzeichnis aufräumen aber .hex-Datei behalten
clean:
$(RM) $(OBJECTS) $(PROJECT).elf $(PROJECT).lst
# Liste der unechten Ziele
.PHONY : all clean program flash
.PRECIOUS : $(OBJECTS) $(PROJECT).elf
Detected encoding: UTF-8 | 0
|