Created
June 16, 2011 06:55
-
-
Save funkfinger/1028804 to your computer and use it in GitHub Desktop.
AVR Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEVICE = attiny2313 | |
#DEVICE = attiny85 | |
CLOCK = 1000000 | |
PROGRAMMER = -c usbtiny | |
#PROGRAMMER = -c dragon_hvsp -P usb | |
# attiny2313 doesn't like dragon_hvsp setting... | |
#PROGRAMMER = -c dragon_pp -P usb | |
OBJECTS = main.o | |
#ATTiny85 fuses... | |
#FUSES = -U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m | |
#ATTiny2313 fuses... | |
FUSES = -U lfuse:w:0x64:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m | |
# generated by http://www.engbedded.com/fusecalc/ | |
AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE) | |
COMPILE = avr-gcc -std=c99 -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) | |
all: main.hex | |
.c.o: | |
$(COMPILE) -c $< -o $@ | |
.S.o: | |
$(COMPILE) -x assembler-with-cpp -c $< -o $@ | |
.c.s: | |
$(COMPILE) -S $< -o $@ | |
flash: all | |
$(AVRDUDE) -U flash:w:main.hex:i | |
fuse: | |
$(AVRDUDE) $(FUSES) | |
install: flash fuse | |
load: all | |
bootloadHID main.hex | |
clean: | |
rm -f main.hex main.elf $(OBJECTS) | |
main.elf: $(OBJECTS) | |
$(COMPILE) -o main.elf $(OBJECTS) | |
main.hex: main.elf | |
rm -f main.hex | |
avr-objcopy -j .text -j .data -O ihex main.elf main.hex | |
disasm: main.elf | |
avr-objdump -d main.elf | |
cpp: | |
$(COMPILE) -E main.c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment