Skip to content

Instantly share code, notes, and snippets.

@pral2a
Last active March 15, 2018 19:10
Show Gist options
  • Save pral2a/274c1925f1606a4b1a1ae1e1d1179537 to your computer and use it in GitHub Desktop.
Save pral2a/274c1925f1606a4b1a1ae1e1d1179537 to your computer and use it in GitHub Desktop.
PROJECT=hello.blink.44
SOURCES=$(PROJECT).c
MMCU=attiny44
MMCU_PROG=t44
F_CPU=1000000
CFLAGS=-mmcu=$(MMCU) -Wall -Os -DF_CPU=$(F_CPU)
$(PROJECT).hex: $(PROJECT).out
avr-objcopy -O ihex $(PROJECT).out $(PROJECT).c.hex;\
avr-size --mcu=$(MMCU) --format=avr $(PROJECT).out
$(PROJECT).out: $(SOURCES)
avr-gcc $(CFLAGS) -I./ -o $(PROJECT).out $(SOURCES)
program-bsd: $(PROJECT).hex
avrdude -p $(MMCU_PROG) -c bsd -U flash:w:$(PROJECT).c.hex
program-dasa: $(PROJECT).hex
avrdude -p $(MMCU_PROG) -P /dev/ttyUSB0 -c dasa -U flash:w:$(PROJECT).c.hex
program-avrisp2: $(PROJECT).hex
avrdude -p $(MMCU_PROG) -P usb -c avrisp2 -U flash:w:$(PROJECT).c.hex
program-usbtiny: $(PROJECT).hex
avrdude -p $(MMCU_PROG) -P usb -c usbtiny -U flash:w:$(PROJECT).c.hex
program-dragon: $(PROJECT).hex
avrdude -p $(MMCU_PROG) -P usb -c dragon_isp -U flash:w:$(PROJECT).c.hex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment