Help with frozen files from an old mpython

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
Ephreal
Posts: 28
Joined: Tue Jan 15, 2019 1:41 pm

Help with frozen files from an old mpython

Post by Ephreal » Mon Jan 10, 2022 9:20 am

Hi

>Moved this from general question because I think it might belong here <

I have an old micropython, where I used both memzip files storage and frozen dir. I have problems with the current latest micropython since memzip is no longer available (as it looks like to me). and the implementation on frozen is changed.

Can anyone guide me on how to port from the old to the new ?

my current make file looks like this.

Code: Select all

FROZEN_MPY_DIR = frozen

include ../micropython-master/py/mkenv.mk

# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h

# include py core make definitions
include ../micropython-master/py/py.mk

CROSS_COMPILE = nios2-elf-

MICROPY_MASTER_DIR = ../micropython-master/
BSP_DIR ?= ../../../bsp/

INC += -I.
INC += -I..
INC += -I$(MICROPY_MASTER_DIR)
INC += -I$(BSP_DIR)/HAL/inc
INC += -I$(BSP_DIR)/drivers/inc
INC += -I$(BSP_DIR)
INC += -I$(BUILD)

CFLAGS = $(INC) -Wall -std=c99 -DMICROPY_NLR_SETJMP
CFLAGS += -O3 -DNDEBUG -ggdb

LIBS =
SRC_C = micropy.c \
        nios2_mphal.c \
        lib/mp-readline/readline.c \
        lib/utils/pyexec.c \
        modmachine.c \
        modtime.c \
        nios2_spi.c \
        simple_file_system.c \
        lib/memzip/import.c \
	    lib/memzip/lexermemzip.c \
	    lib/memzip/memzip.c \

SRC_S = 

OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(SRC_S:.s=.o))
OBJ += $(BUILD)/memzip-files.o

MAKE_MEMZIP = ../micropython-master/lib/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)


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	


# List of sources for qstr extraction
SRC_QSTR += $(SRC_C) $(LIB_SRC_C)
# Append any auto-generated sources that are needed by sources listed in
# SRC_QSTR
SRC_QSTR_AUTO_DEPS +=

all: libmicropy.a

libmicropy.a: $(OBJ)
	$(ECHO) "LINK $@"
	#$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
	ar cr $@ $(OBJ)
	$(SIZE) $@

include ../micropython-master/py/mkrules.mk
Regards

Post Reply