post
poster: Thetawaves
description: Example avr makefile
language: plain text
[download]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
AVRDUDE_PROGRAMMER    := usbtiny
TARGET            := fdioCV2.hex
ELF            := fdioCV2.elf
SRCS            := main.c config.c buffer.c usart.c iocontrol.c rtc.c util.c
CC            := avr-gcc
OBJCOPY            := avr-objcopy

CCFLAGS = -g -mmcu=atmega644pa -Os
AVFLAGS = -c ${AVRDUDE_PROGRAMMER} -p m644p
LDFLAGS = 
LIBS    = 
OCFLAGS = -j .text -j .data -O ihex

.PHONY: all clean distclean 
all:: ${TARGET} 


${TARGET}: ${ELF}
    ${OBJCOPY} ${OCFLAGS} $< $@
    
${ELF}: ${SRCS} 
    ${CC} ${CCFLAGS} ${LDFLAGS} -o $@ ${SRCS} ${LIBS} 

clean:: 
    -rm -f *~ *.o *.dep ${TARGET} ${ELF}
program: ${TARGET}
    avrdude ${AVFLAGS} -U flash:w:${TARGET} -U eeprom:w:config.hex

distclean:: clean