aboutsummaryrefslogtreecommitdiff
path: root/pic16bit/Makefile
diff options
context:
space:
mode:
authorDamien George2015-03-28 21:45:40 +0000
committerDamien George2015-04-03 14:11:19 +0100
commit43ea73faa6f94c816ded5d2d3369f0b49c5834e0 (patch)
treeb6d2eda5ad858ac10513468849eb0343dd62129d /pic16bit/Makefile
parent12ab9eda8dcebb166679cb3b2e8b61facedced68 (diff)
pic16bit: Initial version of port to 16-bit PIC family.
Reference MCU is dsPIC33J256GP506 with 256k ROM and 8k RAM, on the dsPIC DSC Starter Kit board. The REPL works, GC works, pyb module has LED and Switch objects. It passes some tests from the test suite (most it can't run because it doesn't have the Python features enabled).
Diffstat (limited to 'pic16bit/Makefile')
-rw-r--r--pic16bit/Makefile66
1 files changed, 66 insertions, 0 deletions
diff --git a/pic16bit/Makefile b/pic16bit/Makefile
new file mode 100644
index 000000000..4fab7f61c
--- /dev/null
+++ b/pic16bit/Makefile
@@ -0,0 +1,66 @@
+include ../py/mkenv.mk
+
+# qstr definitions (must come before including py.mk)
+QSTR_DEFS = qstrdefsport.h
+
+# include py core make definitions
+include ../py/py.mk
+
+XC16 = /opt/microchip/xc16/v1.24
+CROSS_COMPILE = $(XC16)/bin/xc16-
+
+PARTFAMILY = dsPIC33F
+PART = 33FJ256GP506
+
+INC = -I.
+INC += -I..
+INC += -I../lib/mp-readline
+INC += -I../stmhal
+INC += -I$(BUILD)
+INC += -I$(XC16)/include
+INC += -I$(XC16)/support/$(PARTFAMILY)/h
+
+CFLAGS_PIC16BIT = -mcpu=$(PART) -mlarge-code
+CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -nostdlib $(CFLAGS_PIC16BIT) $(COPT)
+
+#Debugging/Optimization
+ifeq ($(DEBUG), 1)
+CFLAGS += -O0 -ggdb
+else
+CFLAGS += -O1 -DNDEBUG
+endif
+
+LDFLAGS = --heap=0 -nostdlib -T $(XC16)/support/$(PARTFAMILY)/gld/p$(PART).gld -Map=$@.map --cref -p$(PART)
+LIBS = -L$(XC16)/lib -L$(XC16)/lib/$(PARTFAMILY) -lc -lm -lpic30 -lp$(PART)
+
+SRC_C = \
+ main.c \
+ board.c \
+ pic16bit_mphal.c \
+ modpyb.c \
+ modpybled.c \
+ modpybswitch.c \
+ stmhal/pybstdio.c \
+ stmhal/pyexec.c \
+ lib/mp-readline/readline.c \
+
+SRC_S = \
+# gchelper.s \
+
+OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(SRC_S:.s=.o))
+
+all: $(BUILD)/firmware.hex
+
+$(BUILD)/firmware.hex: $(BUILD)/firmware.elf
+ $(ECHO) "Create $@"
+ $(Q)$(CROSS_COMPILE)bin2hex $<
+
+$(BUILD)/firmware.elf: $(OBJ)
+ $(ECHO) "LINK $@"
+ $(Q)$(LD) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
+ $(Q)size $@
+
+$(PY_BUILD)/gc.o: CFLAGS += -O1
+$(PY_BUILD)/vm.o: CFLAGS += -O1
+
+include ../py/mkrules.mk