Using QT I developed a sort of debugger for python code running on my firmware. For this I used the same build of micropython just so that I have a dublicate of mp that will behave just like the one on my firmware.
Now is when the fun begins, I'm having issues when running a script. MP is hanging within the nlr_push() call before compiling and executing the python.
The following coded handles my python execution. I haven't made any meaningful modifications to the "minimal" build of MP other than adding a few printf's:
Code: Select all
nlr_buf_t nlr;
unsigned int nlr_push_result = nlr_push(&nlr);
if (nlr_push_result == 0)
{
qstr source_name = lex->source_name;
mp_parse_tree_t parse_tree = mp_parse(lex, MP_PARSE_FILE_INPUT);
mp_obj_t module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, true);
mp_call_function_0(module_fun);
nlr_pop();
}
else
{
// uncaught exception
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
}