From f9448ddc2c49d7cdaf7dee8ed5e88837e8964f05 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 31 Jan 2016 22:16:41 +0000 Subject: [PATCH] minimal: Add example of frozen persistent bytecode (.mpy file). frozentest.py is frozen into the binary as frozen bytecode. The .mpy file is included so that there is no dependency on the cross compiler. --- minimal/Makefile | 5 +++++ minimal/frozentest.mpy | Bin 0 -> 255 bytes minimal/frozentest.py | 7 +++++++ minimal/mpconfigport.h | 3 ++- 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 minimal/frozentest.mpy create mode 100644 minimal/frozentest.py diff --git a/minimal/Makefile b/minimal/Makefile index 3206a21214..457d63e31e 100644 --- a/minimal/Makefile +++ b/minimal/Makefile @@ -50,6 +50,7 @@ SRC_C = \ lib/utils/pyexec.c \ lib/libc/string0.c \ lib/mp-readline/readline.c \ + $(BUILD)/_frozen_mpy.c \ OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) @@ -59,6 +60,10 @@ else all: $(BUILD)/firmware.elf endif +$(BUILD)/_frozen_mpy.c: frozentest.mpy + $(ECHO) "MISC freezing bytecode" + $(Q)../tools/mpy-tool.py -f -q $(BUILD)/genhdr/qstrdefs.preprocessed.h -mlongint-impl=none $^ > $@ + $(BUILD)/firmware.elf: $(OBJ) $(ECHO) "LINK $@" $(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS) diff --git a/minimal/frozentest.mpy b/minimal/frozentest.mpy new file mode 100644 index 0000000000000000000000000000000000000000..c8345b1910611e890fde2e3058f3c41cf2c19970 GIT binary patch literal 255 zcmeZeV3LnvW&i=+Ck($Cv@|p{v^5wQ{>!v8i2Y$mVKf3V#9=fel+OgAMRvWPB?@FV znDRFmsQhIBDwX*QQrq~_pyh+v>v|)>Xbzj){FKt1R6E|ZqWr4Vypq)761{>-)`FtU zyb|Wp04NK>Mwpg_4ZK5{1lSg}i(q1vIiKFEyoD tEfGaJBe7VaG%qtbKP6S++{Sa8&TUpm&PXgOPU23g1Uf>&(8$