Created
May 4, 2016 07:17
-
-
Save MichaelThessel/e66dfc3205e854ecf276a3238416f622 to your computer and use it in GitHub Desktop.
AVR Makefile Template
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
BIN=main | |
OBJS=main.o | |
SRCS=main.c | |
MCU=atmega328p | |
SPEED=16000000UL | |
LIBS=-L usbdrv | |
CC=avr-gcc | |
OBJCOPY=avr-objcopy | |
CFLAGS=-Os -DF_CPU=${SPEED} -mmcu=${MCU} ${LIBS} -std=gnu99 | |
default: build flash | |
build: ${BIN}.hex | |
${BIN}.elf: ${SRCS} | |
${CC} ${CFLAGS} -o $@ $^ | |
${BIN}.hex: ${BIN}.elf | |
${OBJCOPY} -O ihex -R .eeprom $< $@ | |
flash: ${BIN}.hex | |
avrdude -F -V -c dragon_isp -p atmega328 -U flash:w:$< | |
clean: | |
rm -f ${BIN}.elf ${BIN}.hex ${OBJS} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment