summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-09-26 17:05:40 +1000
committerDamien George <damien.p.george@gmail.com>2019-09-26 17:05:40 +1000
commit3328b7d71f2758d6e278cd5f3c230d427f46ff01 (patch)
tree49bf50dd93cb2e6693bd06a7f7981a9c51abd1dd
parent095f90f04e996b6b60b193c7b164cdfd096f808c (diff)
stm32: Support disabling the compiler.
Disable via "#define MICROPY_ENABLE_COMPILER (0)" in the board's mpconfigboard.h file.
-rw-r--r--ports/stm32/main.c4
-rw-r--r--ports/stm32/mpconfigport.h4
2 files changed, 6 insertions, 2 deletions
diff --git a/ports/stm32/main.c b/ports/stm32/main.c
index 93beb0fd7..48ad3b8be 100644
--- a/ports/stm32/main.c
+++ b/ports/stm32/main.c
@@ -144,7 +144,9 @@ STATIC mp_obj_t pyb_main(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_a
// parse args
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
+ #if MICROPY_ENABLE_COMPILER
MP_STATE_VM(mp_optimise_value) = args[0].u_int;
+ #endif
}
return mp_const_none;
}
@@ -701,6 +703,7 @@ soft_reset:
}
}
+ #if MICROPY_ENABLE_COMPILER
// Main script is finished, so now go into REPL mode.
// The REPL mode can change, or it can request a soft reset.
for (;;) {
@@ -714,6 +717,7 @@ soft_reset:
}
}
}
+ #endif
soft_reset_exit:
diff --git a/ports/stm32/mpconfigport.h b/ports/stm32/mpconfigport.h
index 5eb44bd46..20554d9e6 100644
--- a/ports/stm32/mpconfigport.h
+++ b/ports/stm32/mpconfigport.h
@@ -101,8 +101,8 @@
#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1)
#define MICROPY_PY_BUILTINS_ROUND_INT (1)
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
-#define MICROPY_PY_BUILTINS_COMPILE (1)
-#define MICROPY_PY_BUILTINS_EXECFILE (1)
+#define MICROPY_PY_BUILTINS_COMPILE (MICROPY_ENABLE_COMPILER)
+#define MICROPY_PY_BUILTINS_EXECFILE (MICROPY_ENABLE_COMPILER)
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1)
#define MICROPY_PY_BUILTINS_INPUT (1)
#define MICROPY_PY_BUILTINS_POW3 (1)