Skript file: /~heha/mb-iwp/UZD1/Firmware.zip/Makefile

# Makefile für ATtiny24-Firmware auf Doppel-Digitalvoltmeter
# für UZD1 und vergleichbare Labornetzteile
# Henrik Haftmann, 190528
P = ddvm
D = attiny24
F = 1000000

AVRDUDE = crundll InpOut32,CatchIo avrdude -c pony-stk200 -p $D -P lpt1 -E noreset -V
PATH := c:\programs\winavr\gcc492\bin;$(PATH)

# Compiler und Linker:
C = avr-gcc -Wall -Wno-parentheses -Os -mmcu=$D -D F_CPU=$F
# -D DEBUG
#no-parentheses: Ich weiß selbst wo Klammern nötig sind
#no-array-bounds: Flash-Stringadressen nicht im Flash (0..7FFF)
#no-char-subscripts: Bytes als Array-Indizes sind okay für kleine Arrays

all: $P.lst

# Alle C++-Dateien sind (der Einfachheit halber) von allen Kopfdateien abhängig
$P.elf: main.cpp Makefile
	$C -o $@ $(filter %.cpp,$^)
# Das alte avr-size aufheben! Das neue kann kein -C
	avr-size -C --mcu=$D $@

$P.hex: $P.elf
	avr-objcopy -j .text -j .data -O ihex $< $@

$P.lst: $P.elf
	avr-objdump -d $< > $@
	avr-strip $<

# via ISP-Schnittstelle = MISO, MOSI, SCK und RESET
flash: $P.hex
	$(AVRDUDE) -U flash:w:$<
Detected encoding: UTF-80