Commit 733db525 authored by Damien George's avatar Damien George
Browse files

stmhal: Add Makefile option FROZEN_MPY_DIR to support frozen bytecode.

parent f9448ddc
...@@ -279,6 +279,28 @@ $(BUILD)/frozen-files.c: $(shell find $(FROZEN_DIR) -type f) ...@@ -279,6 +279,28 @@ $(BUILD)/frozen-files.c: $(shell find $(FROZEN_DIR) -type f)
$(Q)$(PYTHON) $(MAKE_FROZEN) $(FROZEN_DIR) > $@ $(Q)$(PYTHON) $(MAKE_FROZEN) $(FROZEN_DIR) > $@
endif endif
ifneq ($(FROZEN_MPY_DIR),)
# To use frozen bytecode, put your .py files in a subdirectory (eg frozen/) and
# then invoke make with FROZEN_MPY_DIR=frozen (be sure to build from scratch).
FROZEN_MPY_FILES := $(wildcard $(FROZEN_MPY_DIR)/*.py)
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
OBJ += $(BUILD)/$(FROZEN_MPY_DIR)/frozen_mpy.o
MPY_CROSS = ../mpy-cross/mpy-cross
MPY_TOOL = ../tools/mpy-tool.py
$(BUILD)/$(FROZEN_MPY_DIR)/%.mpy: $(FROZEN_MPY_DIR)/%.py
@$(ECHO) "MPY $<"
$(Q)$(MPY_CROSS) -o $@ $^
$(BUILD)/$(FROZEN_MPY_DIR)/frozen_mpy.c: $(addprefix $(BUILD)/,$(FROZEN_MPY_FILES:.py=.mpy))
@$(ECHO) "Creating $@"
$(Q)$(PYTHON) $(MPY_TOOL) -f -q $(BUILD)/genhdr/qstrdefs.preprocessed.h $^ > $@
$(BUILD)/$(FROZEN_MPY_DIR)/frozen_mpy.o: $(BUILD)/$(FROZEN_MPY_DIR)/frozen_mpy.c
$(call compile_c)
endif
.PHONY: deploy .PHONY: deploy
deploy: $(BUILD)/firmware.dfu deploy: $(BUILD)/firmware.dfu
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment