summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-05-16 23:13:30 +0100
committerDamien George <damien.p.george@gmail.com>2016-05-16 23:13:30 +0100
commit99b4719357f52cdc945db3ca7213b21d43297170 (patch)
tree22ed8148e396faf1717a74d11041d1553e07c985
parent21ec1fd8504eb9c50d09be67be396707c1be411e (diff)
downloadmicropython-99b4719357f52cdc945db3ca7213b21d43297170.tar.gz
micropython-99b4719357f52cdc945db3ca7213b21d43297170.zip
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.
-rwxr-xr-xtools/mpy-tool.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py
index 74106f192a..a1cc1f0e06 100755
--- a/tools/mpy-tool.py
+++ b/tools/mpy-tool.py
@@ -450,6 +450,23 @@ def freeze_mpy(qcfgs, base_qstrs, raw_codes):
print('#include "py/emitglue.h"')
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('typedef struct _mp_obj_float_t {')
print(' mp_obj_base_t base;')