|
|
@ -1,9 +1,16 @@ |
|
|
|
# define main target
|
|
|
|
all: all2 |
|
|
|
|
|
|
|
# include py core make definitions
|
|
|
|
include ../py/py.mk |
|
|
|
|
|
|
|
# program for deletion
|
|
|
|
RM = /bin/rm |
|
|
|
|
|
|
|
STMSRC=lib |
|
|
|
#STMOTGSRC=lib-otg
|
|
|
|
FATFSSRC=fatfs |
|
|
|
CC3KSRC=cc3k |
|
|
|
PYSRC=../py |
|
|
|
BUILD=build |
|
|
|
DFU=../tools/dfu.py |
|
|
|
TARGET=PYBOARD |
|
|
|
|
|
|
@ -11,7 +18,7 @@ AS = arm-none-eabi-as |
|
|
|
CC = arm-none-eabi-gcc |
|
|
|
LD = arm-none-eabi-ld |
|
|
|
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion -DSTM32F40XX -DHSE_VALUE=8000000 |
|
|
|
CFLAGS = -I. -I$(PYSRC) -I$(FATFSSRC) -I$(STMSRC) -Wall -ansi -std=gnu99 -Os -DNDEBUG $(CFLAGS_CORTEX_M4) -D$(TARGET) |
|
|
|
CFLAGS = -I. -I$(PY_SRC) -I$(FATFSSRC) -I$(STMSRC) -Wall -ansi -std=gnu99 -Os -DNDEBUG $(CFLAGS_CORTEX_M4) -D$(TARGET) |
|
|
|
#CFLAGS += -I$(STMOTGSRC) -DUSE_HOST_MODE -DUSE_OTG_MODE
|
|
|
|
LDFLAGS = --nostdlib -T stm32f405.ld |
|
|
|
|
|
|
@ -43,53 +50,6 @@ SRC_S = \ |
|
|
|
startup_stm32f40xx.s \
|
|
|
|
gchelper.s \
|
|
|
|
|
|
|
|
PY_O = \
|
|
|
|
nlrthumb.o \
|
|
|
|
gc.o \
|
|
|
|
malloc.o \
|
|
|
|
qstr.o \
|
|
|
|
vstr.o \
|
|
|
|
unicode.o \
|
|
|
|
lexer.o \
|
|
|
|
parse.o \
|
|
|
|
scope.o \
|
|
|
|
compile.o \
|
|
|
|
emitcommon.o \
|
|
|
|
emitpass1.o \
|
|
|
|
emitbc.o \
|
|
|
|
asmthumb.o \
|
|
|
|
emitnthumb.o \
|
|
|
|
emitinlinethumb.o \
|
|
|
|
runtime.o \
|
|
|
|
map.o \
|
|
|
|
obj.o \
|
|
|
|
objbool.o \
|
|
|
|
objboundmeth.o \
|
|
|
|
objcell.o \
|
|
|
|
objclass.o \
|
|
|
|
objclosure.o \
|
|
|
|
objcomplex.o \
|
|
|
|
objdict.o \
|
|
|
|
objexcept.o \
|
|
|
|
objfloat.o \
|
|
|
|
objfun.o \
|
|
|
|
objgenerator.o \
|
|
|
|
objinstance.o \
|
|
|
|
objint.o \
|
|
|
|
objlist.o \
|
|
|
|
objmodule.o \
|
|
|
|
objnone.o \
|
|
|
|
objrange.o \
|
|
|
|
objset.o \
|
|
|
|
objslice.o \
|
|
|
|
objstr.o \
|
|
|
|
objtuple.o \
|
|
|
|
objtype.o \
|
|
|
|
builtin.o \
|
|
|
|
builtinimport.o \
|
|
|
|
vm.o \
|
|
|
|
repl.o \
|
|
|
|
|
|
|
|
SRC_FATFS = \
|
|
|
|
ff.c \
|
|
|
|
diskio.c \
|
|
|
@ -146,10 +106,10 @@ SRC_CC3K = \ |
|
|
|
ccspi.c \
|
|
|
|
pybcc3k.c \
|
|
|
|
|
|
|
|
OBJ = $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(SRC_S:.s=.o) $(PY_O) $(SRC_FATFS:.c=.o) $(SRC_STM:.c=.o) $(SRC_CC3K:.c=.o)) |
|
|
|
OBJ = $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(SRC_S:.s=.o) $(SRC_FATFS:.c=.o) $(SRC_STM:.c=.o) $(SRC_CC3K:.c=.o)) $(PY_O) |
|
|
|
#OBJ += $(addprefix $(BUILD)/, $(SRC_STM_OTG:.c=.o))
|
|
|
|
|
|
|
|
all: $(BUILD) $(BUILD)/flash.dfu |
|
|
|
all2: $(BUILD) $(BUILD)/flash.dfu |
|
|
|
|
|
|
|
$(BUILD)/flash.dfu: $(BUILD)/flash0.bin $(BUILD)/flash1.bin |
|
|
|
python $(DFU) -b 0x08000000:$(BUILD)/flash0.bin -b 0x08020000:$(BUILD)/flash1.bin $@ |
|
|
@ -164,9 +124,6 @@ $(BUILD)/flash.elf: $(OBJ) |
|
|
|
$(LD) $(LDFLAGS) -o $@ $(OBJ) |
|
|
|
arm-none-eabi-size $@ |
|
|
|
|
|
|
|
$(BUILD): |
|
|
|
mkdir -p $@ |
|
|
|
|
|
|
|
$(BUILD)/%.o: %.s |
|
|
|
$(AS) -o $@ $< |
|
|
|
|
|
|
@ -185,31 +142,7 @@ $(BUILD)/%.o: $(STMSRC)/%.c |
|
|
|
$(BUILD)/%.o: $(CC3KSRC)/%.c |
|
|
|
$(CC) $(CFLAGS) -c -o $@ $< |
|
|
|
|
|
|
|
$(BUILD)/%.o: $(PYSRC)/%.s |
|
|
|
$(AS) -o $@ $< |
|
|
|
|
|
|
|
$(BUILD)/%.o: $(PYSRC)/%.S |
|
|
|
$(CC) $(CFLAGS) -c -o $@ $< |
|
|
|
|
|
|
|
$(BUILD)/%.o: $(PYSRC)/%.c mpconfigport.h |
|
|
|
$(CC) $(CFLAGS) -c -o $@ $< |
|
|
|
|
|
|
|
$(BUILD)/emitnthumb.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h |
|
|
|
$(CC) $(CFLAGS) -DN_THUMB -c -o $@ $< |
|
|
|
|
|
|
|
# optimising gc for speed; 5ms down to 4ms
|
|
|
|
$(BUILD)/gc.o: $(PYSRC)/gc.c |
|
|
|
$(CC) $(CFLAGS) -O3 -c -o $@ $< |
|
|
|
|
|
|
|
# optimising vm for speed, adds only a small amount to code size but makes a huge difference to speed (20% faster)
|
|
|
|
$(BUILD)/vm.o: $(PYSRC)/vm.c |
|
|
|
$(CC) $(CFLAGS) -O3 -c -o $@ $< |
|
|
|
|
|
|
|
$(BUILD)/parse.o: $(PYSRC)/grammar.h |
|
|
|
$(BUILD)/compile.o: $(PYSRC)/grammar.h |
|
|
|
$(BUILD)/emitbc.o: $(PYSRC)/emit.h |
|
|
|
|
|
|
|
clean: |
|
|
|
/bin/rm -rf $(BUILD) |
|
|
|
$(RM) -rf $(BUILD) |
|
|
|
|
|
|
|
.PHONY: all clean |
|
|
|
.PHONY: all all2 clean |
|
|
|