# # Makefile template for ATtiny85 # Derived from AVR Crosspack template # DEVICE = attiny85 # See avr-help for all possible devices CLOCK = 8000000 # 1Mhz PROGRAMMER = -c avrisp -P /dev/cu.usbmodem1421 # For using Adafruit USBtiny OBJECTS = main.o # Add more objects for each .c file here FUSES = -U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m # settings as taken from http://www.engbedded.com/fusecalc/ #put avrdude.conf from /Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf in the folder of the code you want to compile! AVRDUDE = /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C avrdude.conf $(PROGRAMMER) -p $(DEVICE) COMPILE = /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) # symbolic targets: 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 # if you use a bootloader, change the command below appropriately: load: all bootloadHID main.hex clean: rm -f main.hex main.elf $(OBJECTS) # file targets: main.elf: $(OBJECTS) $(COMPILE) -o main.elf $(OBJECTS) main.hex: main.elf rm -f main.hex /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-objcopy -j .text -j .data -O ihex main.elf main.hex /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-size --format=avr --mcu=$(DEVICE) main.elf # If you have an EEPROM section, you must also create a hex file for the # EEPROM and add it to the "flash" target. # Targets for code debugging and analysis: disasm: main.elf avr-objdump -d main.elf cpp: $(COMPILE) -E main.c