Commit 99b47193 authored by Damien George's avatar Damien George
Browse files

tools/mpy-tool.py: Add checks for critical configuration vars.

When an mpy file is frozen it must know the values of certain
configuration variables.  This patch provides an explicit check in the
generated C file that the configuration variables are what they are
supposed to be.
parent 21ec1fd8
...@@ -450,6 +450,23 @@ def freeze_mpy(qcfgs, base_qstrs, raw_codes): ...@@ -450,6 +450,23 @@ def freeze_mpy(qcfgs, base_qstrs, raw_codes):
print('#include "py/emitglue.h"') print('#include "py/emitglue.h"')
print() print()
print('#if MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE')
print('#error "MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE not supported with frozen mpy files"')
print('#endif')
print()
print('#if MICROPY_LONGINT_IMPL != %u' % config.MICROPY_LONGINT_IMPL)
print('#error "incompatible MICROPY_LONGINT_IMPL"')
print('#endif')
print()
if config.MICROPY_LONGINT_IMPL == config.MICROPY_LONGINT_IMPL_MPZ:
print('#if MPZ_DIG_SIZE != %u' % config.MPZ_DIG_SIZE)
print('#error "incompatible MPZ_DIG_SIZE"')
print('#endif')
print()
print('#if MICROPY_PY_BUILTINS_FLOAT') print('#if MICROPY_PY_BUILTINS_FLOAT')
print('typedef struct _mp_obj_float_t {') print('typedef struct _mp_obj_float_t {')
print(' mp_obj_base_t base;') print(' mp_obj_base_t base;')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment