Created
September 20, 2012 09:46
-
-
Save Gautier/3754972 to your computer and use it in GitHub Desktop.
Makefile for arduino avr programs
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
MCU='atmega328p' | |
F_CPU=16000000 | |
PORT='/dev/ttyACM0' | |
UPLOAD_RATE=115200 | |
SOURCES=main.c | |
all: compile | |
compile: build/main.hex | |
upload: build/main.hex | |
avrdude -p $(MCU) -P $(PORT) -c arduino -b $(UPLOAD_RATE) -U flash:w:build/main.hex:i | |
build/main.elf: build *.c | |
avr-gcc -o build/main.elf -mmcu=$(MCU) -DF_CPU=$(F_CPU) $(SOURCES) | |
build/main.hex: build/main.elf | |
avr-objcopy -O ihex -R .eeprom build/main.elf build/main.hex | |
build: | |
mkdir build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment