Skript file: /~heha/basteln/Konsumgüter/Funkuhr/AD-Bandbreite.zip/Makefile

# Band, Bandbeiten-Text
DEVICE=atmega48
AVRDUDE = avrdude -c pony-stk200 -P lpt1 -p $(DEVICE)

COMPILE = avr-gcc -Wall -Os -mmcu=$(DEVICE) -DF_CPU=12000000

OBJECTS = Band.o

all: Band.hex
program: flash
disasm: Band.lst

Band.o: Band.c Makefile
	$(COMPILE) -c $< -o $@

flash: Band.hex
	$(AVRDUDE) -U flash:w:Band.hex:i -E noreset

HFUSE = 0xDD
# 1 1 0 1   1 1 0 1
# │ │ │ │   │ └─┴─┴─── BODLEVEL	(Brown-out detection level: 2.7V)
# │ │ │ │   └───────── EESAVE	(preserve EEPROM over chip erase: NO)
# │ │ │ └───────────── WDTON	(Watchdog Timer always On: NO)
# │ │ └─────────────── SPIEN	(Serial Programming enable: YES)
# │ └───────────────── DWEN	(debugWIRE Enable: NO)
# └─────────────────── RSTDISBL	(External Reset Disable: NO)

LFUSE = 0xFF
# 1 1 1 1   1 1 1 1
# │ │ └┬┘   └─┬─┘ │
# │ │  │      └───┼─── CKSEL	(Oscillator selection: Low-Power Quartz crystal)
# │ │  └──────────┴─── SUT	(Start-up time: langsam)
# │ └───────────────── CKOUT	(Clock output at PB0: NO)
# └─────────────────── CKDIV8	(Initial clock division by 8: NO)

program:
	$(AVRDUDE) -U hfuse:w:$(HFUSE):m -U lfuse:w:$(LFUSE):m -U flash:w:Band.hex:i -E noreset

clean:
	rm -f Band.hex Band.lst Band.elf *.o

# file targets:
Band.elf: $(OBJECTS)
	$(COMPILE) -o $@ $(OBJECTS)
	avr-size --mcu=$(DEVICE) -C $@

Band.hex: Band.elf
	rm -f Band.hex Band.eep
	avr-objcopy -j .text -j .data -O ihex $< $@

Band.lst: Band.elf
	avr-objdump -d $< >$@
Detected encoding: UTF-80