2017-09-06 00:09:13 -04:00
|
|
|
include ../../py/mkenv.mk
|
2015-03-28 17:45:40 -04:00
|
|
|
|
|
|
|
# qstr definitions (must come before including py.mk)
|
|
|
|
QSTR_DEFS = qstrdefsport.h
|
|
|
|
|
|
|
|
# include py core make definitions
|
2017-08-10 22:22:19 -04:00
|
|
|
include $(TOP)/py/py.mk
|
2022-06-17 12:11:30 -04:00
|
|
|
include $(TOP)/extmod/extmod.mk
|
2015-03-28 17:45:40 -04:00
|
|
|
|
2021-04-24 11:41:55 -04:00
|
|
|
XCVERSION ?= 1.35
|
|
|
|
XC16 ?= /opt/microchip/xc16/v$(XCVERSION)
|
2019-12-21 15:22:26 -05:00
|
|
|
CROSS_COMPILE ?= $(XC16)/bin/xc16-
|
2015-03-28 17:45:40 -04:00
|
|
|
|
|
|
|
PARTFAMILY = dsPIC33F
|
|
|
|
PART = 33FJ256GP506
|
|
|
|
|
2015-10-19 11:22:16 -04:00
|
|
|
INC += -I.
|
2017-08-10 22:22:19 -04:00
|
|
|
INC += -I$(TOP)
|
2015-03-28 17:45:40 -04:00
|
|
|
INC += -I$(BUILD)
|
|
|
|
INC += -I$(XC16)/include
|
|
|
|
INC += -I$(XC16)/support/$(PARTFAMILY)/h
|
|
|
|
|
|
|
|
CFLAGS_PIC16BIT = -mcpu=$(PART) -mlarge-code
|
2022-10-08 08:08:53 -04:00
|
|
|
CFLAGS += $(INC) -Wall -Werror -std=gnu99 -nostdlib $(CFLAGS_PIC16BIT) $(COPT)
|
2015-03-28 17:45:40 -04:00
|
|
|
|
|
|
|
#Debugging/Optimization
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CFLAGS += -O0 -ggdb
|
|
|
|
else
|
|
|
|
CFLAGS += -O1 -DNDEBUG
|
|
|
|
endif
|
|
|
|
|
2022-10-08 08:08:53 -04:00
|
|
|
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
|
2015-03-28 17:45:40 -04:00
|
|
|
|
|
|
|
SRC_C = \
|
|
|
|
main.c \
|
|
|
|
board.c \
|
|
|
|
pic16bit_mphal.c \
|
|
|
|
modpyb.c \
|
|
|
|
modpybled.c \
|
|
|
|
modpybswitch.c \
|
2021-07-09 00:19:15 -04:00
|
|
|
shared/runtime/pyexec.c \
|
|
|
|
shared/runtime/sys_stdio_mphal.c \
|
|
|
|
shared/readline/readline.c \
|
2015-03-28 17:45:40 -04:00
|
|
|
|
|
|
|
SRC_S = \
|
|
|
|
# gchelper.s \
|
|
|
|
|
|
|
|
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(SRC_S:.s=.o))
|
|
|
|
|
py: Add rules for automated extraction of qstrs from sources.
- add template rule that converts a specified source file into a qstring file
- add special rule for generating a central header that contains all
extracted/autogenerated strings - defined by QSTR_DEFS_COLLECTED
variable. Each platform appends a list of sources that may contain
qstrings into a new build variable: SRC_QSTR. Any autogenerated
prerequisities are should be appened to SRC_QSTR_AUTO_DEPS variable.
- remove most qstrings from py/qstrdefs, keep only qstrings that
contain special characters - these cannot be easily detected in the
sources without additional annotations
- remove most manual qstrdefs, use qstrdef autogen for: py, cc3200,
stmhal, teensy, unix, windows, pic16bit:
- remove all micropython generic qstrdefs except for the special strings that contain special characters (e.g. /,+,<,> etc.)
- remove all port specific qstrdefs except for special strings
- append sources for qstr generation in platform makefiles (SRC_QSTR)
2016-03-10 04:22:41 -05:00
|
|
|
# List of sources for qstr extraction
|
|
|
|
SRC_QSTR += $(SRC_C)
|
|
|
|
# Append any auto-generated sources that are needed by sources listed in
|
|
|
|
# SRC_QSTR
|
|
|
|
SRC_QSTR_AUTO_DEPS +=
|
|
|
|
|
2015-03-28 17:45:40 -04:00
|
|
|
all: $(BUILD)/firmware.hex
|
|
|
|
|
|
|
|
$(BUILD)/firmware.hex: $(BUILD)/firmware.elf
|
|
|
|
$(ECHO) "Create $@"
|
|
|
|
$(Q)$(CROSS_COMPILE)bin2hex $<
|
|
|
|
|
|
|
|
$(BUILD)/firmware.elf: $(OBJ)
|
|
|
|
$(ECHO) "LINK $@"
|
2015-10-23 19:26:10 -04:00
|
|
|
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
2015-03-28 17:45:40 -04:00
|
|
|
$(Q)size $@
|
|
|
|
|
|
|
|
$(PY_BUILD)/gc.o: CFLAGS += -O1
|
|
|
|
$(PY_BUILD)/vm.o: CFLAGS += -O1
|
|
|
|
|
2017-08-10 22:22:19 -04:00
|
|
|
include $(TOP)/py/mkrules.mk
|