lib/utils/pyexec: Add MICROPY_BOARD hooks before/after executing code.
Signed-off-by: Damien George <damien@micropython.org>bound-method-equality
parent
b99300b53e
commit
7789cd5f16
|
@ -68,10 +68,15 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
|
||||||
uint32_t start = 0;
|
uint32_t start = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MICROPY_BOARD_BEFORE_PYTHON_EXEC
|
||||||
|
MICROPY_BOARD_BEFORE_PYTHON_EXEC(input_kind, exec_flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
// by default a SystemExit exception returns 0
|
// by default a SystemExit exception returns 0
|
||||||
pyexec_system_exit = 0;
|
pyexec_system_exit = 0;
|
||||||
|
|
||||||
nlr_buf_t nlr;
|
nlr_buf_t nlr;
|
||||||
|
nlr.ret_val = NULL;
|
||||||
if (nlr_push(&nlr) == 0) {
|
if (nlr_push(&nlr) == 0) {
|
||||||
mp_obj_t module_fun;
|
mp_obj_t module_fun;
|
||||||
#if MICROPY_MODULE_FROZEN_MPY
|
#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);
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue