summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/zephyr/main.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/ports/zephyr/main.c b/ports/zephyr/main.c
index 45af7b0c7..9addd7d6c 100644
--- a/ports/zephyr/main.c
+++ b/ports/zephyr/main.c
@@ -156,7 +156,17 @@ soft_reset:
#endif
#if MICROPY_MODULE_FROZEN || MICROPY_VFS
- pyexec_file_if_exists("main.py");
+ // Execute user scripts.
+ int ret = pyexec_file_if_exists("boot.py");
+ if (ret & PYEXEC_FORCED_EXIT) {
+ goto soft_reset_exit;
+ }
+ if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL && ret != 0) {
+ ret = pyexec_file_if_exists("main.py");
+ if (ret & PYEXEC_FORCED_EXIT) {
+ goto soft_reset_exit;
+ }
+ }
#endif
for (;;) {
@@ -171,7 +181,11 @@ soft_reset:
}
}
- printf("soft reboot\n");
+ #if MICROPY_MODULE_FROZEN || MICROPY_VFS
+soft_reset_exit:
+ #endif
+
+ mp_printf(MP_PYTHON_PRINTER, "MPY: soft reboot\n");
#if MICROPY_PY_BLUETOOTH
mp_bluetooth_deinit();