Created
April 27, 2011 02:13
-
-
Save funkfinger/943607 to your computer and use it in GitHub Desktop.
My AVR ATTiny85 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 = attiny85 | |
CLOCK = 1000000 | |
PROGRAMMER = -c usbtiny | |
OBJECTS = main.o | |
FUSES = -U lfuse:w:0x62: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 -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