aboutsummaryrefslogtreecommitdiff
path: root/firmware/Makefile
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2011-03-11 01:28:00 +0000
committerDimitri Sokolyuk <demon@dim13.org>2011-03-11 01:28:00 +0000
commitb8335062ae7d19bd27e6131fadcd7d3a116c4992 (patch)
tree3bd226885fb6f2ca24ee300a44d7b51ffb8d2706 /firmware/Makefile
DimOS RT
Diffstat (limited to 'firmware/Makefile')
-rw-r--r--firmware/Makefile61
1 files changed, 61 insertions, 0 deletions
diff --git a/firmware/Makefile b/firmware/Makefile
new file mode 100644
index 0000000..a65993e
--- /dev/null
+++ b/firmware/Makefile
@@ -0,0 +1,61 @@
+# $Id$
+
+PROG = firmware
+SRCS = firmware.c
+HEADERS =
+MCU_TARGET = atmega8
+F_CPU = 16000000
+PRESCALE = 8
+BAUD = 9600
+ORG = 0x1e00
+
+# You should not have to change anything below here.
+
+OBJS = ${SRCS:.c=.o}
+CC = avr-gcc
+CFLAGS = -Wall -Os -mmcu=${MCU_TARGET} \
+ -DF_CPU=${F_CPU} -DPRESCALE=${PRESCALE} -DBAUD=${BAUD}
+LDFLAGS = -Wl,-Map,${PROG}.map,--section-start=.text=${ORG}
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+
+.SUFFIXES: .elf .lst .hex .bin .srec .ehex .ebin .esrec
+
+all: ${PROG}.elf ${PROG}.lst ${PROG}.hex ${PROG}.ehex size
+
+${SRCS}: ${HEADERS} Makefile
+
+${PROG}.elf: ${OBJS}
+ ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
+
+size: ${PROG}.elf
+ ${SIZE} -C --mcu=${MCU_TARGET} ${.ALLSRC}
+
+clean:
+ rm -f *.o ${PROG}.elf *.bak *.lst *.map *.hex *.bin *srec *.ehex *.ebin *.esrec
+
+.elf.lst:
+ ${OBJDUMP} -h -S ${.ALLSRC} > ${.TARGET}
+
+# Rules for building the .text rom images
+
+.elf.hex:
+ ${OBJCOPY} -j .text -j .data -O ihex ${.ALLSRC} ${.TARGET}
+
+.elf.bin:
+ ${OBJCOPY} -j .text -j .data -O binary ${.ALLSRC} ${.TARGET}
+
+.elf.srec:
+ ${OBJCOPY} -j .text -j .data -O srec ${.ALLSRC} ${.TARGET}
+
+# Rules for building the .eeprom rom images
+
+.elf.ehex:
+ ${OBJCOPY} -j .eeprom --change-section-lma .eeprom=0 -O ihex ${.ALLSRC} ${.TARGET}
+
+.elf.ebin:
+ ${OBJCOPY} -j .eeprom --change-section-lma .eeprom=0 -O binary ${.ALLSRC} ${.TARGET}
+
+.elf.esrec:
+ ${OBJCOPY} -j .eeprom --change-section-lma .eeprom=0 -O srec ${.ALLSRC} ${.TARGET}