Skip to content

Instantly share code, notes, and snippets.

@smcl
Created November 11, 2015 13:20
Show Gist options
  • Save smcl/384eea305670136983dc to your computer and use it in GitHub Desktop.
Save smcl/384eea305670136983dc to your computer and use it in GitHub Desktop.
CC = avr-gcc
PROCESSOR = atmega328p
FREQ = 16000000
AVRDUDE_CONFIG = arduino
AVRDUDE_PART = ATMEGA328P
AVRDUDE_PROGRAMMING_DEVICE = /dev/tty.usbmodem1421
AVRDUDE_BAUD = 115200
all: buildhex
clean:
rm *.o *.hex blink
build:
$(CC) -Os -DF_CPU=$(FREQ)UL -mmcu=$(PROCESSOR) blink.c
buildhex: build
avr-objcopy -O ihex -R .eeprom blink blink.hex
flash: buildhex
avrdude -F -V -c $(AVRDUDE_CONFIG) -p $(AVRDUDE_PART) -P $(AVRDUDE_PROGRAMMING_DEVICE) -b $(AVRDUDE_BAUD) -U flash:w:blink.hex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment