Last active
May 9, 2017 10:57
-
-
Save draganmarjanovic/45f1b0fe01f686809433271b7ef94da5 to your computer and use it in GitHub Desktop.
Makefile - ATMEGA324A
This file contains hidden or 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: Dragan Marjanovic | |
# Based on https://github.com/obdev/CrossPack-AVR/ | |
DEVICE = atmega324a | |
CLOCK = 8000000 | |
PROGRAMMER = -c avrispmkii | |
OBJECTS = project.o | |
AVRDUDE = avrdude $(PROGRAMMER) -p m324pa -F -B10 | |
COMPILE = avr-gcc -Wall -Os -std=gnu99 -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) | |
# symbolic targets: | |
all: project.hex | |
.c.o: | |
$(COMPILE) -c $< -o $@ | |
.c.s: | |
$(COMPILE) -S $< -o $@ | |
.S.o: | |
$(COMPILE) -x assembler-with-cpp -c $< -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.elfa | |
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