Skip to content

Commit

Permalink
teensy: Switch to use manifest.py instead of FROZEN_DIR.
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
  • Loading branch information
jimmo authored and dpgeorge committed Dec 17, 2021
1 parent cc23e99 commit f241db7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 40 deletions.
77 changes: 37 additions & 40 deletions ports/teensy/Makefile
Expand Up @@ -6,6 +6,42 @@ QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h
# MicroPython feature configurations
MICROPY_ROM_TEXT_COMPRESSION ?= 1

USE_FROZEN = 1
USE_MEMZIP = 0

ifeq ($(USE_MEMZIP),1)
SRC_C += \
shared/memzip/import.c \
shared/memzip/lexermemzip.c \
shared/memzip/memzip.c \

OBJ += $(BUILD)/memzip-files.o

MAKE_MEMZIP = $(TOP)/shared/memzip/make-memzip.py
ifeq ($(MEMZIP_DIR),)
MEMZIP_DIR = memzip_files
endif

$(BUILD)/memzip-files.o: $(BUILD)/memzip-files.c
$(call compile_c)

$(BUILD)/memzip-files.c: $(shell find ${MEMZIP_DIR} -type f)
@$(ECHO) "Creating $@"
$(Q)$(PYTHON) $(MAKE_MEMZIP) --zip-file $(BUILD)/memzip-files.zip --c-file $@ $(MEMZIP_DIR)

endif # USE_MEMZIP

ifeq ($(USE_FROZEN),1)

FROZEN_MANIFEST ?= "manifest.py"

CFLAGS += -DMICROPY_MODULE_FROZEN_STR

SRC_C += \
lexerfrozen.c

endif # USE_FROZEN

# include py core make definitions
include $(TOP)/py/py.mk

Expand Down Expand Up @@ -76,10 +112,7 @@ endif
CFLAGS += -fdata-sections -ffunction-sections
LDFLAGS += -Wl,--gc-sections

USE_FROZEN = 1
USE_MEMZIP = 0

SRC_C = \
SRC_C += \
hal_ftm.c \
hal_gpio.c \
help.c \
Expand Down Expand Up @@ -127,42 +160,6 @@ OBJ += $(BUILD)/pins_gen.o
all: hex
hex: $(BUILD)/micropython.hex

ifeq ($(USE_MEMZIP),1)
SRC_C += \
shared/memzip/import.c \
shared/memzip/lexermemzip.c \
shared/memzip/memzip.c \

OBJ += $(BUILD)/memzip-files.o

MAKE_MEMZIP = $(TOP)/shared/memzip/make-memzip.py
ifeq ($(MEMZIP_DIR),)
MEMZIP_DIR = memzip_files
endif

$(BUILD)/memzip-files.o: $(BUILD)/memzip-files.c
$(call compile_c)

$(BUILD)/memzip-files.c: $(shell find ${MEMZIP_DIR} -type f)
@$(ECHO) "Creating $@"
$(Q)$(PYTHON) $(MAKE_MEMZIP) --zip-file $(BUILD)/memzip-files.zip --c-file $@ $(MEMZIP_DIR)

endif # USE_MEMZIP

ifeq ($(USE_FROZEN),1)

ifeq ($(FROZEN_DIR),)
FROZEN_DIR = memzip_files
endif

CFLAGS += -DMICROPY_MODULE_FROZEN_STR

SRC_C += \
lexerfrozen.c \
$(BUILD)/frozen.c

endif # USE_FROZEN

ifeq ($(ARDUINO),)
post_compile: $(BUILD)/micropython.hex
$(ECHO) "Please define ARDUINO (where TeensyDuino is installed)"
Expand Down
1 change: 1 addition & 0 deletions ports/teensy/manifest.py
@@ -0,0 +1 @@
freeze_as_str("$(PORT_DIR)/memzip_files")

0 comments on commit f241db7

Please sign in to comment.