diff --git a/lib/libesp32/berry/src/be_bytecode.c b/lib/libesp32/berry/src/be_bytecode.c index e7ba8aaca..90ff79c6f 100644 --- a/lib/libesp32/berry/src/be_bytecode.c +++ b/lib/libesp32/berry/src/be_bytecode.c @@ -23,7 +23,7 @@ #define MAGIC_NUMBER1 0xBE #define MAGIC_NUMBER2 0xCD #define MAGIC_NUMBER3 0xFE -#define BYTECODE_VERSION 3 +#define BYTECODE_VERSION 4 #define USE_64BIT_INT (BE_INTGER_TYPE == 2 \ || BE_INTGER_TYPE == 1 && LONG_MAX == 9223372036854775807L) @@ -333,7 +333,6 @@ static int load_head(void *fp) res = buffer[0] == MAGIC_NUMBER1 && buffer[1] == MAGIC_NUMBER2 && buffer[2] == MAGIC_NUMBER3 && - buffer[3] <= BYTECODE_VERSION && buffer[4] == vm_sizeinfo(); if (res) { return buffer[3]; @@ -425,7 +424,8 @@ static void load_class(bvm *vm, void *fp, bvalue *v, int version) be_incrtop(vm); if (load_proto(vm, fp, (bproto**)&var_toobj(value), -3, version)) { /* actual method */ - be_class_method_bind(vm, c, name, var_toobj(value), bfalse); + bbool is_method = ((bproto*)var_toobj(value))->varg & BE_VA_METHOD; + be_class_method_bind(vm, c, name, var_toobj(value), !is_method); } else { /* no proto, static member set to nil */ be_class_member_bind(vm, c, name, bfalse); @@ -572,7 +572,7 @@ bclosure* be_bytecode_load(bvm *vm, const char *filename) "can not open file '%s'.", filename)); } else { int version = load_head(fp); - if (version) { + if (version == BYTECODE_VERSION) { bclosure *cl = be_newclosure(vm, 0); var_setclosure(vm->top, cl); be_stackpush(vm); @@ -582,6 +582,8 @@ bclosure* be_bytecode_load(bvm *vm, const char *filename) be_fclose(fp); return cl; } + bytecode_error(vm, be_pushfstring(vm, + "invalid bytecode version '%s'.", filename)); } bytecode_error(vm, be_pushfstring(vm, "invalid bytecode file '%s'.", filename)); diff --git a/lib/libesp32/berry/tools/grammar/berry.bytecode b/lib/libesp32/berry/tools/grammar/berry.bytecode index 2d71dde22..6b90c2a1d 100755 --- a/lib/libesp32/berry/tools/grammar/berry.bytecode +++ b/lib/libesp32/berry/tools/grammar/berry.bytecode @@ -21,7 +21,7 @@ bytecode_file: -- little endian header: 8 magic_number: 3 -- 0xbecdfe (berry code file) - version: 2 -- update with file structure definition + version: 1 -- 0x03 update with file structure definition integer_size: .1 float_size: .1 -- reserved space diff --git a/tasmota/berry/modules/partition.bec b/tasmota/berry/modules/partition.bec new file mode 100644 index 000000000..6ee8be094 Binary files /dev/null and b/tasmota/berry/modules/partition.bec differ