all: Remove support for FROZEN_DIR and FROZEN_MPY_DIR.
These have been deprecated for over two years in favour of FROZEN_MANIFEST and manifest.py. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
parent
f241db7efe
commit
92353c2911
@ -27,8 +27,6 @@ AXTLS_DEFS_EXTRA = -Dabort=abort_ -DRT_MAX_PLAIN_LENGTH=1024 -DRT_EXTRA=4096
|
|||||||
BTREE_DEFS_EXTRA = -DDEFPSIZE=1024 -DMINCACHE=3
|
BTREE_DEFS_EXTRA = -DDEFPSIZE=1024 -DMINCACHE=3
|
||||||
|
|
||||||
FROZEN_MANIFEST ?= boards/manifest.py
|
FROZEN_MANIFEST ?= boards/manifest.py
|
||||||
FROZEN_DIR ?=
|
|
||||||
FROZEN_MPY_DIR ?=
|
|
||||||
|
|
||||||
# include py core make definitions
|
# include py core make definitions
|
||||||
include $(TOP)/py/py.mk
|
include $(TOP)/py/py.mk
|
||||||
@ -196,12 +194,9 @@ $(BUILD)/uart.o: $(CONFVARS_FILE)
|
|||||||
|
|
||||||
FROZEN_EXTRA_DEPS = $(CONFVARS_FILE)
|
FROZEN_EXTRA_DEPS = $(CONFVARS_FILE)
|
||||||
|
|
||||||
ifneq ($(FROZEN_MANIFEST)$(FROZEN_MPY_DIR),)
|
ifneq ($(FROZEN_MANIFEST),)
|
||||||
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
||||||
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(FROZEN_MANIFEST)$(FROZEN_DIR),)
|
|
||||||
CFLAGS += -DMICROPY_MODULE_FROZEN_STR
|
CFLAGS += -DMICROPY_MODULE_FROZEN_STR
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -17,13 +17,6 @@ CFLAGS += -std=c99 -Wall -Werror -Wdouble-promotion -Wfloat-conversion
|
|||||||
CFLAGS += -O3 -DNDEBUG
|
CFLAGS += -O3 -DNDEBUG
|
||||||
CFLAGS += $(INC)
|
CFLAGS += $(INC)
|
||||||
|
|
||||||
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).
|
|
||||||
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
|
||||||
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
|
||||||
endif
|
|
||||||
|
|
||||||
SRC_SHARED = $(addprefix shared/,\
|
SRC_SHARED = $(addprefix shared/,\
|
||||||
runtime/interrupt_char.c \
|
runtime/interrupt_char.c \
|
||||||
runtime/stdout_helpers.c \
|
runtime/stdout_helpers.c \
|
||||||
|
@ -340,11 +340,6 @@ DRIVERS_SRC_C += $(addprefix modules/,\
|
|||||||
SRC_C += \
|
SRC_C += \
|
||||||
device/startup_$(MCU_SUB_VARIANT).c \
|
device/startup_$(MCU_SUB_VARIANT).c \
|
||||||
|
|
||||||
ifneq ($(FROZEN_MPY_DIR),)
|
|
||||||
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py')
|
|
||||||
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBGCC_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
LIBGCC_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
||||||
LIBS += -L $(dir $(LIBGCC_FILE_NAME)) -lgcc
|
LIBS += -L $(dir $(LIBGCC_FILE_NAME)) -lgcc
|
||||||
|
|
||||||
@ -542,17 +537,10 @@ GEN_PINS_QSTR = $(BUILD)/pins_qstr.h
|
|||||||
GEN_PINS_AF_CONST = $(HEADER_BUILD)/pins_af_const.h
|
GEN_PINS_AF_CONST = $(HEADER_BUILD)/pins_af_const.h
|
||||||
GEN_PINS_AF_PY = $(BUILD)/pins_af.py
|
GEN_PINS_AF_PY = $(BUILD)/pins_af.py
|
||||||
|
|
||||||
ifneq ($(FROZEN_MANIFEST)$(FROZEN_DIR),)
|
ifneq ($(FROZEN_MANIFEST),)
|
||||||
# To use frozen source modules, put your .py files in a subdirectory (eg scripts/)
|
|
||||||
# and then invoke make with FROZEN_DIR=scripts (be sure to build from scratch).
|
|
||||||
CFLAGS += -DMICROPY_MODULE_FROZEN_STR
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(FROZEN_MANIFEST)$(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).
|
|
||||||
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
||||||
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
||||||
|
CFLAGS += -DMICROPY_MODULE_FROZEN_STR
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(PY_BUILD)/nlr%.o: CFLAGS += -Os -fno-lto
|
$(PY_BUILD)/nlr%.o: CFLAGS += -Os -fno-lto
|
||||||
|
@ -96,20 +96,6 @@ The **make sd** will trigger a flash of the bluetooth stack before that applicat
|
|||||||
|
|
||||||
Note: further tuning of features to include in bluetooth or even setting up the device to use REPL over Bluetooth can be configured in the `bluetooth_conf.h`.
|
Note: further tuning of features to include in bluetooth or even setting up the device to use REPL over Bluetooth can be configured in the `bluetooth_conf.h`.
|
||||||
|
|
||||||
## Compile with frozen modules
|
|
||||||
|
|
||||||
Frozen modules are Python modules compiled to bytecode and added to the firmware
|
|
||||||
image, as part of MicroPython. They can be imported as usual, using the `import`
|
|
||||||
statement. The advantage is that frozen modules use a lot less RAM as the
|
|
||||||
bytecode is stored in flash, not in RAM like when importing from a filesystem.
|
|
||||||
Also, frozen modules are available even when no filesystem is present to import
|
|
||||||
from.
|
|
||||||
|
|
||||||
To use frozen modules, put them in a directory (e.g. `freeze/`) and supply
|
|
||||||
`make` with the given directory. For example:
|
|
||||||
|
|
||||||
make BOARD=pca10040 FROZEN_MPY_DIR=freeze
|
|
||||||
|
|
||||||
## Compile with freeze manifest
|
## Compile with freeze manifest
|
||||||
|
|
||||||
Freeze manifests can be used by definining `FROZEN_MANIFEST` pointing to a
|
Freeze manifests can be used by definining `FROZEN_MANIFEST` pointing to a
|
||||||
|
@ -596,17 +596,10 @@ $(TOP)/lib/stm32lib/README.md:
|
|||||||
$(ECHO) "stm32lib submodule not found, fetching it now..."
|
$(ECHO) "stm32lib submodule not found, fetching it now..."
|
||||||
(cd $(TOP) && git submodule update --init lib/stm32lib)
|
(cd $(TOP) && git submodule update --init lib/stm32lib)
|
||||||
|
|
||||||
ifneq ($(FROZEN_MANIFEST)$(FROZEN_DIR),)
|
ifneq ($(FROZEN_MANIFEST),)
|
||||||
# To use frozen source modules, put your .py files in a subdirectory (eg scripts/)
|
|
||||||
# and then invoke make with FROZEN_DIR=scripts (be sure to build from scratch).
|
|
||||||
CFLAGS += -DMICROPY_MODULE_FROZEN_STR
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(FROZEN_MANIFEST)$(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).
|
|
||||||
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
||||||
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
||||||
|
CFLAGS += -DMICROPY_MODULE_FROZEN_STR
|
||||||
endif
|
endif
|
||||||
|
|
||||||
define RUN_DFU
|
define RUN_DFU
|
||||||
|
@ -13,10 +13,8 @@ include ../../py/mkenv.mk
|
|||||||
-include mpconfigport.mk
|
-include mpconfigport.mk
|
||||||
include $(VARIANT_DIR)/mpconfigvariant.mk
|
include $(VARIANT_DIR)/mpconfigvariant.mk
|
||||||
|
|
||||||
# use FROZEN_MANIFEST for new projects, others are legacy
|
# Use the default frozen manifest, variants may override this.
|
||||||
FROZEN_MANIFEST ?= variants/manifest.py
|
FROZEN_MANIFEST ?= variants/manifest.py
|
||||||
FROZEN_DIR =
|
|
||||||
FROZEN_MPY_DIR =
|
|
||||||
|
|
||||||
# This should be configured by the mpconfigvariant.mk
|
# This should be configured by the mpconfigvariant.mk
|
||||||
PROG ?= micropython
|
PROG ?= micropython
|
||||||
@ -263,15 +261,12 @@ SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SHARED_SRC_C) $(EXTMOD_SRC_C)
|
|||||||
# SRC_QSTR
|
# SRC_QSTR
|
||||||
SRC_QSTR_AUTO_DEPS +=
|
SRC_QSTR_AUTO_DEPS +=
|
||||||
|
|
||||||
ifneq ($(FROZEN_MANIFEST)$(FROZEN_MPY_DIR),)
|
ifneq ($(FROZEN_MANIFEST),)
|
||||||
# To use frozen code create a manifest.py file with a description of files to
|
# To use frozen code create a manifest.py file with a description of files to
|
||||||
# freeze, then invoke make with FROZEN_MANIFEST=manifest.py (be sure to build from scratch).
|
# freeze, then invoke make with FROZEN_MANIFEST=manifest.py (be sure to build from scratch).
|
||||||
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
||||||
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
||||||
CFLAGS += -DMPZ_DIG_SIZE=16 # force 16 bits to work on both 32 and 64 bit archs
|
CFLAGS += -DMPZ_DIG_SIZE=16 # force 16 bits to work on both 32 and 64 bit archs
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(FROZEN_MANIFEST)$(FROZEN_DIR),)
|
|
||||||
CFLAGS += -DMICROPY_MODULE_FROZEN_STR
|
CFLAGS += -DMICROPY_MODULE_FROZEN_STR
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -142,43 +142,18 @@ $(MICROPY_MPYCROSS_DEPENDENCY):
|
|||||||
$(MAKE) -C $(dir $@)
|
$(MAKE) -C $(dir $@)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(FROZEN_DIR),)
|
||||||
|
$(error Support for FROZEN_DIR was removed. Please use manifest.py instead, see https://docs.micropython.org/en/latest/reference/manifest.html)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(FROZEN_MPY_DIR),)
|
||||||
|
$(error Support for FROZEN_MPY_DIR was removed. Please use manifest.py instead, see https://docs.micropython.org/en/latest/reference/manifest.html)
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(FROZEN_MANIFEST),)
|
ifneq ($(FROZEN_MANIFEST),)
|
||||||
# to build frozen_content.c from a manifest
|
# to build frozen_content.c from a manifest
|
||||||
$(BUILD)/frozen_content.c: FORCE $(BUILD)/genhdr/qstrdefs.generated.h | $(MICROPY_MPYCROSS_DEPENDENCY)
|
$(BUILD)/frozen_content.c: FORCE $(BUILD)/genhdr/qstrdefs.generated.h | $(MICROPY_MPYCROSS_DEPENDENCY)
|
||||||
$(Q)$(MAKE_MANIFEST) -o $@ -v "MPY_DIR=$(TOP)" -v "MPY_LIB_DIR=$(MPY_LIB_DIR)" -v "PORT_DIR=$(shell pwd)" -v "BOARD_DIR=$(BOARD_DIR)" -b "$(BUILD)" $(if $(MPY_CROSS_FLAGS),-f"$(MPY_CROSS_FLAGS)",) --mpy-tool-flags="$(MPY_TOOL_FLAGS)" $(FROZEN_MANIFEST)
|
$(Q)$(MAKE_MANIFEST) -o $@ -v "MPY_DIR=$(TOP)" -v "MPY_LIB_DIR=$(MPY_LIB_DIR)" -v "PORT_DIR=$(shell pwd)" -v "BOARD_DIR=$(BOARD_DIR)" -b "$(BUILD)" $(if $(MPY_CROSS_FLAGS),-f"$(MPY_CROSS_FLAGS)",) --mpy-tool-flags="$(MPY_TOOL_FLAGS)" $(FROZEN_MANIFEST)
|
||||||
|
|
||||||
ifneq ($(FROZEN_DIR),)
|
|
||||||
$(error FROZEN_DIR cannot be used in conjunction with FROZEN_MANIFEST)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(FROZEN_MPY_DIR),)
|
|
||||||
$(error FROZEN_MPY_DIR cannot be used in conjunction with FROZEN_MANIFEST)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(FROZEN_DIR),)
|
|
||||||
$(info Warning: FROZEN_DIR is deprecated in favour of FROZEN_MANIFEST)
|
|
||||||
$(BUILD)/frozen.c: $(wildcard $(FROZEN_DIR)/*) $(HEADER_BUILD) $(FROZEN_EXTRA_DEPS)
|
|
||||||
$(ECHO) "GEN $@"
|
|
||||||
$(Q)$(MAKE_FROZEN) $(FROZEN_DIR) > $@
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(FROZEN_MPY_DIR),)
|
|
||||||
$(info Warning: FROZEN_MPY_DIR is deprecated in favour of FROZEN_MANIFEST)
|
|
||||||
# make a list of all the .py files that need compiling and freezing
|
|
||||||
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py' | $(SED) -e 's=^$(FROZEN_MPY_DIR)/==')
|
|
||||||
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/frozen_mpy/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
|
|
||||||
|
|
||||||
# to build .mpy files from .py files
|
|
||||||
$(BUILD)/frozen_mpy/%.mpy: $(FROZEN_MPY_DIR)/%.py | $(MICROPY_MPYCROSS_DEPENDENCY)
|
|
||||||
@$(ECHO) "MPY $<"
|
|
||||||
$(Q)$(MKDIR) -p $(dir $@)
|
|
||||||
$(Q)$(MICROPY_MPYCROSS) -o $@ -s $(<:$(FROZEN_MPY_DIR)/%=%) $(MPY_CROSS_FLAGS) $<
|
|
||||||
|
|
||||||
# to build frozen_mpy.c from all .mpy files
|
|
||||||
$(BUILD)/frozen_mpy.c: $(FROZEN_MPY_MPY_FILES) $(BUILD)/genhdr/qstrdefs.generated.h
|
|
||||||
@$(ECHO) "GEN $@"
|
|
||||||
$(Q)$(MPY_TOOL) -f -q $(BUILD)/genhdr/qstrdefs.preprocessed.h $(FROZEN_MPY_MPY_FILES) > $@
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(PROG),)
|
ifneq ($(PROG),)
|
||||||
@ -234,27 +209,6 @@ clean:
|
|||||||
$(RM) -rf $(BUILD) $(CLEAN_EXTRA)
|
$(RM) -rf $(BUILD) $(CLEAN_EXTRA)
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
# Clean every non-git file from FROZEN_DIR/FROZEN_MPY_DIR, but making a backup.
|
|
||||||
# We run rmdir below to avoid empty backup dir (it will silently fail if backup
|
|
||||||
# is non-empty).
|
|
||||||
clean-frozen:
|
|
||||||
if [ -n "$(FROZEN_MPY_DIR)" ]; then \
|
|
||||||
backup_dir=$(FROZEN_MPY_DIR).$$(date +%Y%m%dT%H%M%S); mkdir $$backup_dir; \
|
|
||||||
cd $(FROZEN_MPY_DIR); git status --ignored -u all -s . | awk ' {print $$2}' \
|
|
||||||
| xargs --no-run-if-empty cp --parents -t ../$$backup_dir; \
|
|
||||||
rmdir ../$$backup_dir 2>/dev/null || true; \
|
|
||||||
git clean -d -f .; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$(FROZEN_DIR)" ]; then \
|
|
||||||
backup_dir=$(FROZEN_DIR).$$(date +%Y%m%dT%H%M%S); mkdir $$backup_dir; \
|
|
||||||
cd $(FROZEN_DIR); git status --ignored -u all -s . | awk ' {print $$2}' \
|
|
||||||
| xargs --no-run-if-empty cp --parents -t ../$$backup_dir; \
|
|
||||||
rmdir ../$$backup_dir 2>/dev/null || true; \
|
|
||||||
git clean -d -f .; \
|
|
||||||
fi
|
|
||||||
.PHONY: clean-frozen
|
|
||||||
|
|
||||||
print-cfg:
|
print-cfg:
|
||||||
$(ECHO) "PY_SRC = $(PY_SRC)"
|
$(ECHO) "PY_SRC = $(PY_SRC)"
|
||||||
$(ECHO) "BUILD = $(BUILD)"
|
$(ECHO) "BUILD = $(BUILD)"
|
||||||
|
10
py/py.mk
10
py/py.mk
@ -227,16 +227,6 @@ ifneq ($(FROZEN_MANIFEST),)
|
|||||||
PY_O += $(BUILD)/$(BUILD)/frozen_content.o
|
PY_O += $(BUILD)/$(BUILD)/frozen_content.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# object file for frozen files
|
|
||||||
ifneq ($(FROZEN_DIR),)
|
|
||||||
PY_O += $(BUILD)/$(BUILD)/frozen.o
|
|
||||||
endif
|
|
||||||
|
|
||||||
# object file for frozen bytecode (frozen .mpy files)
|
|
||||||
ifneq ($(FROZEN_MPY_DIR),)
|
|
||||||
PY_O += $(BUILD)/$(BUILD)/frozen_mpy.o
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Sources that may contain qstrings
|
# Sources that may contain qstrings
|
||||||
SRC_QSTR_IGNORE = py/nlr%
|
SRC_QSTR_IGNORE = py/nlr%
|
||||||
SRC_QSTR += $(SRC_MOD) $(filter-out $(SRC_QSTR_IGNORE),$(PY_CORE_O_BASENAME:.o=.c)) $(PY_EXTMOD_O_BASENAME:.o=.c)
|
SRC_QSTR += $(SRC_MOD) $(filter-out $(SRC_QSTR_IGNORE),$(PY_CORE_O_BASENAME:.o=.c)) $(PY_EXTMOD_O_BASENAME:.o=.c)
|
||||||
|
Loading…
Reference in New Issue
Block a user