summaryrefslogtreecommitdiffstatshomepage
path: root/lib/utils/pyexec.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2020-10-31 00:22:11 +1100
committerDamien George <damien@micropython.org>2020-11-11 21:47:13 +1100
commit7789cd5f16b068f032e58be8e5e60bf17cb03d40 (patch)
tree78626f497ee0137f30424ebe79ba6fcfacd22357 /lib/utils/pyexec.c
parentb99300b53ecc8db1ced8d96953ba4eaf2026f069 (diff)
downloadmicropython-7789cd5f16b068f032e58be8e5e60bf17cb03d40.tar.gz
micropython-7789cd5f16b068f032e58be8e5e60bf17cb03d40.zip
lib/utils/pyexec: Add MICROPY_BOARD hooks before/after executing code.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'lib/utils/pyexec.c')
-rw-r--r--lib/utils/pyexec.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c
index 2c8ca2de0c..2b86af3bba 100644
--- a/lib/utils/pyexec.c
+++ b/lib/utils/pyexec.c
@@ -68,10 +68,15 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
uint32_t start = 0;
#endif
+ #ifdef MICROPY_BOARD_BEFORE_PYTHON_EXEC
+ MICROPY_BOARD_BEFORE_PYTHON_EXEC(input_kind, exec_flags);
+ #endif
+
// by default a SystemExit exception returns 0
pyexec_system_exit = 0;
nlr_buf_t nlr;
+ nlr.ret_val = NULL;
if (nlr_push(&nlr) == 0) {
mp_obj_t module_fun;
#if MICROPY_MODULE_FROZEN_MPY
@@ -157,6 +162,10 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
mp_hal_stdout_tx_strn("\x04", 1);
}
+ #ifdef MICROPY_BOARD_AFTER_PYTHON_EXEC
+ MICROPY_BOARD_AFTER_PYTHON_EXEC(input_kind, exec_flags, nlr.ret_val, &ret);
+ #endif
+
return ret;
}