Created
February 20, 2016 09:52
-
-
Save TRManderson/0da3df529f4744fad7d2 to your computer and use it in GitHub Desktop.
My AVR makefile for a uni course last year
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
# Name: Makefile | |
# Author: Tom Manderson | |
# Based on https://github.com/obdev/CrossPack-AVR/ | |
DEVICE = atmega324a | |
CLOCK = 8000000 | |
PROGRAMMER = -c avrispmkii | |
OBJECTS = project.o buttons.o game.o ledmatrix.o score.o scrolling_char_display.o serialio.o spi.o terminalio.o timer0.o | |
AVRDUDE = avrdude $(PROGRAMMER) -p m324pa -F | |
COMPILE = avr-gcc -Wall -Os -std=c99 -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) | |
# symbolic targets: | |
all: project.hex | |
.c.o: | |
$(COMPILE) -c $< -o $@ | |
.c.s: | |
$(COMPILE) -S $< -o $@ | |
flash: all | |
$(AVRDUDE) -U flash:w:project.hex:i | |
clean: | |
rm -f project.hex project.elf $(OBJECTS) | |
# file targets: | |
project.elf: $(OBJECTS) | |
$(COMPILE) -o project.elf $(OBJECTS) | |
project.hex: project.elf | |
rm -f project.hex | |
avr-objcopy -j .text -j .data -O ihex project.elf project.hex | |
avr-size --format=avr --mcu=$(DEVICE) project.elf | |
disasm: project.elf | |
avr-objdump -d project.elf | |
cpp: | |
$(COMPILE) -E project.c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment