mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Split script parse_compile_execute function.
* This avoids interrupting parser with pendsv (which causes a hardfault). * Not sure what the real issue is, but this solution works for now.
This commit is contained in:
parent
ef6b564b87
commit
10758f376b
@ -1 +1 @@
|
|||||||
Subproject commit 8a34ce6e073985628bc7ed0148fb8dc1c5282c13
|
Subproject commit 0193a8e152e7dca387a321772a761a2e8282b194
|
||||||
@ -361,13 +361,17 @@ FRESULT exec_boot_script(const char *path, bool selftest, bool interruptible)
|
|||||||
|
|
||||||
if (f_res == FR_OK) {
|
if (f_res == FR_OK) {
|
||||||
if (nlr_push(&nlr) == 0) {
|
if (nlr_push(&nlr) == 0) {
|
||||||
// Enable IDE interrupts if allowed
|
// Parse and compile the script.
|
||||||
|
mp_obj_t code = pyexec_compile_file(path);
|
||||||
|
|
||||||
|
// Enable IDE interrupts if allowed.
|
||||||
if (interruptible) {
|
if (interruptible) {
|
||||||
usbdbg_set_irq_enabled(true);
|
usbdbg_set_irq_enabled(true);
|
||||||
usbdbg_set_script_running(true);
|
usbdbg_set_script_running(true);
|
||||||
}
|
}
|
||||||
// Parse, compile and execute the main script.
|
|
||||||
pyexec_file(path);
|
// Execute the compiled script.
|
||||||
|
pyexec_exec_code(code);
|
||||||
nlr_pop();
|
nlr_pop();
|
||||||
} else {
|
} else {
|
||||||
interrupted = true;
|
interrupted = true;
|
||||||
@ -597,13 +601,16 @@ soft_reset:
|
|||||||
|
|
||||||
if (usbdbg_script_ready()) {
|
if (usbdbg_script_ready()) {
|
||||||
nlr_buf_t nlr;
|
nlr_buf_t nlr;
|
||||||
|
|
||||||
// execute the script
|
|
||||||
if (nlr_push(&nlr) == 0) {
|
if (nlr_push(&nlr) == 0) {
|
||||||
// enable IDE interrupt
|
// Parse and compile the script
|
||||||
|
vstr_t *buf = usbdbg_get_script();
|
||||||
|
mp_obj_t code = pyexec_compile_str(buf);
|
||||||
|
|
||||||
|
// Enable IDE interrupt
|
||||||
usbdbg_set_irq_enabled(true);
|
usbdbg_set_irq_enabled(true);
|
||||||
|
|
||||||
pyexec_str(usbdbg_get_script());
|
// Execute the compiled script
|
||||||
|
pyexec_exec_code(code);
|
||||||
nlr_pop();
|
nlr_pop();
|
||||||
} else {
|
} else {
|
||||||
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
|
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user