summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore8
-rw-r--r--Makefile33
-rw-r--r--src/font.h (renamed from font.h)0
-rw-r--r--src/font2.h (renamed from font2.h)0
-rw-r--r--src/main.cc (renamed from main.cc)0
-rw-r--r--src/modem.c (renamed from modem.c)0
-rw-r--r--src/modem.h (renamed from modem.h)0
7 files changed, 19 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index 975c237..84c048a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1 @@
-*.o
-*.eep
-*.elf
-*.hex
-*.lss
-*.map
-*.sym
+/build/
diff --git a/Makefile b/Makefile
index 4c0bbd1..2aea16c 100644
--- a/Makefile
+++ b/Makefile
@@ -21,42 +21,45 @@ ASFLAGS += ${MCU_FLAGS} -wA,--warn
LDFLAGS += -Wl,--gc-sections
AVRFLAGS += -U lfuse:w:0xee:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
-AVRFLAGS += -U flash:w:main.hex
+AVRFLAGS += -U flash:w:build/main.hex
#AVRFLAGS += -U eeprom:w:main.eep
-HEADERS = $(wildcard *.h)
-ASFILES = $(wildcard *.S)
-CFILES = $(wildcard *.c)
-CXXFILES = $(wildcard *.cc)
-OBJECTS = ${CFILES:.c=.o} ${CXXFILES:.cc=.o} ${ASFILES:.S=.o}
+HEADERS = $(wildcard src/*.h)
+ASFILES = $(wildcard src/*.S)
+CFILES = $(wildcard src/*.c)
+CXXFILES = $(wildcard src/*.cc)
+OBJECTS = ${CFILES:src/%.c=build/%.o} ${CXXFILES:src/%.cc=build/%.o} ${ASFILES:src/%.S=build/%.o}
-all: main.elf
+all: build build/main.elf
-%.hex: %.elf
+build:
+ mkdir -p build
+
+build/%.hex: build/%.elf
${AVROBJCOPY} -O ihex -R .eeprom $< $@
-%.eep: %.elf
+build/%.eep: build/%.elf
${AVROBJCOPY} -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O ihex $< $@
-%.o: %.cc ${HEADERS}
+build/%.o: src/%.cc ${HEADERS}
${AVRCXX} ${CXXFLAGS} -o $@ $< -c -Wl,-Map=main.map,--cref
-%.o: %.c ${HEADERS}
+build/%.o: src/%.c ${HEADERS}
${AVRCC} ${CFLAGS} -o $@ $< -c -Wl,-Map=main.map,--cref
-main.elf: ${OBJECTS}
+build/main.elf: ${OBJECTS}
${AVRCXX} ${CXXFLAGS} -o $@ $^ ${LDFLAGS}
@echo
@avr-size --format=avr --mcu=${MCU} $@
-program: main.hex #main.eep
+program: build/main.hex #main.eep
${AVRFLASH} -p ${MCU} -c ${AVRDUDE_PROGRAMMER} ${AVRFLAGS}
-secsize: main.elf
+secsize: build/main.elf
${AVROBJDUMP} -hw -j.text -j.bss -j.data main.elf
-funsize: main.elf
+funsize: build/main.elf
${AVRNM} --print-size --size-sort main.elf
.PHONY: all program secsize funsize
diff --git a/font.h b/src/font.h
index 839277b..839277b 100644
--- a/font.h
+++ b/src/font.h
diff --git a/font2.h b/src/font2.h
index aea6b8a..aea6b8a 100644
--- a/font2.h
+++ b/src/font2.h
diff --git a/main.cc b/src/main.cc
index c51483d..c51483d 100644
--- a/main.cc
+++ b/src/main.cc
diff --git a/modem.c b/src/modem.c
index dbe9d35..dbe9d35 100644
--- a/modem.c
+++ b/src/modem.c
diff --git a/modem.h b/src/modem.h
index d538c22..d538c22 100644
--- a/modem.h
+++ b/src/modem.h