summaryrefslogtreecommitdiff
path: root/firmware/Makefile
diff options
context:
space:
mode:
authorCamil Staps2016-08-22 22:21:37 +0200
committerCamil Staps2016-08-22 22:21:37 +0200
commitde5e94a6b1a8f95aa6b10e0c8ee26b79b0772ebc (patch)
tree9c9ba025b7a3cbbb7be1b860f164702e17af0aa7 /firmware/Makefile
Initial commit; t6963c + blink an led
Diffstat (limited to 'firmware/Makefile')
-rw-r--r--firmware/Makefile70
1 files changed, 70 insertions, 0 deletions
diff --git a/firmware/Makefile b/firmware/Makefile
new file mode 100644
index 0000000..919d167
--- /dev/null
+++ b/firmware/Makefile
@@ -0,0 +1,70 @@
+MCU:=24FJ256DA206
+
+IDIR=.
+ODIR=build
+
+CC:=xc16-gcc
+CFLAGS:=\
+ -Wall\
+ -I$(IDIR)\
+ -mcpu=$(MCU)\
+ -g\
+ -msmart-io=1\
+ -Wl,--script=p$(MCU).gld\
+ -Wl,--gc-sections\
+ -Wl,--stack=16\
+ -Wl,--local-stack\
+ -Wl,--check-sections\
+ -Wl,--data-init\
+ -Wl,--pack-data\
+ -Wl,--handles\
+ -Wl,--isr\
+ -Wl,--no-gc-sections\
+ -Wl,--fill-upper=0\
+ -Wl,--stackguard=16\
+ -Wl,--no-force-link\
+ -Wl,--smart-io
+
+BIN2HEX:=xc16-bin2hex
+
+_HEX:=main.hex
+HEX:=$(patsubst %,$(ODIR)/%,$(_HEX))
+
+_DEPS:=\
+ t6963c_specific.h\
+ t6963c/t6963c.h\
+ t6963c/terminal.h
+DEPS:=$(patsubst %,$(IDIR)/%,$(_DEPS))
+
+_OBJ:=main.o $(subst .h,.o,$(_DEPS))
+OBJ:=$(patsubst %,$(ODIR)/%,$(_OBJ))
+
+_ASM:=$(subst .o,.s,$(_OBJ))
+ASM:=$(patsubst %,$(ODIR)/%,$(_ASM))
+
+.PHONY: all all_hex all_assembly clean
+
+all: all_hex
+
+all_hex: $(HEX)
+
+all_assembly: $(ASM)
+
+$(ODIR)/%.hex: $(ODIR)/%.out
+ $(BIN2HEX) $<
+
+$(ODIR)/%.out: $(OBJ)
+ $(CC) $(CFLAGS)\
+ -Wl,-Map -Wl,$(ODIR)/$(notdir $(basename $@)).map\
+ -o $@ $^
+
+$(ODIR)/%.o: %.c $(DEPS)
+ mkdir -p $(dir $@)
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+$(ODIR)/%.s: %.c
+ mkdir -p $(dir $@)
+ $(CC) $(CFLAGS) -S -o $@ $<
+
+clean:
+ $(RM) -r $(ODIR)