ports: Make all ports skip execution of main.py if boot.py fails.
That can be caused e.g. by an exception. This feature is implemented in some way already for the stm32, renesas-ra, mimxrt and samd ports. This commit adds it for the rp2, esp8266, esp32 and nrf ports. No change for the cc3200 and teensy ports. Signed-off-by: robert-hh <robert@hammelrath.com>
This commit is contained in:
parent
d2a9d70c09
commit
480659b1ac
@ -124,8 +124,11 @@ soft_reset:
|
|||||||
|
|
||||||
// run boot-up scripts
|
// run boot-up scripts
|
||||||
pyexec_frozen_module("_boot.py", false);
|
pyexec_frozen_module("_boot.py", false);
|
||||||
pyexec_file_if_exists("boot.py");
|
int ret = pyexec_file_if_exists("boot.py");
|
||||||
if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) {
|
if (ret & PYEXEC_FORCED_EXIT) {
|
||||||
|
goto soft_reset_exit;
|
||||||
|
}
|
||||||
|
if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL && ret != 0) {
|
||||||
int ret = pyexec_file_if_exists("main.py");
|
int ret = pyexec_file_if_exists("main.py");
|
||||||
if (ret & PYEXEC_FORCED_EXIT) {
|
if (ret & PYEXEC_FORCED_EXIT) {
|
||||||
goto soft_reset_exit;
|
goto soft_reset_exit;
|
||||||
|
@ -83,8 +83,8 @@ STATIC void mp_reset(void) {
|
|||||||
|
|
||||||
#if MICROPY_MODULE_FROZEN
|
#if MICROPY_MODULE_FROZEN
|
||||||
pyexec_frozen_module("_boot.py", false);
|
pyexec_frozen_module("_boot.py", false);
|
||||||
pyexec_file_if_exists("boot.py");
|
int ret = pyexec_file_if_exists("boot.py");
|
||||||
if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) {
|
if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL && ret != 0) {
|
||||||
pyexec_file_if_exists("main.py");
|
pyexec_file_if_exists("main.py");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -263,8 +263,10 @@ soft_reset:
|
|||||||
|
|
||||||
#if MICROPY_VFS || MICROPY_MBFS || MICROPY_MODULE_FROZEN
|
#if MICROPY_VFS || MICROPY_MBFS || MICROPY_MODULE_FROZEN
|
||||||
// run boot.py and main.py if they exist.
|
// run boot.py and main.py if they exist.
|
||||||
pyexec_file_if_exists("boot.py");
|
ret = pyexec_file_if_exists("boot.py");
|
||||||
pyexec_file_if_exists("main.py");
|
if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL && ret != 0) {
|
||||||
|
pyexec_file_if_exists("main.py");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -179,7 +179,7 @@ int main(int argc, char **argv) {
|
|||||||
if (ret & PYEXEC_FORCED_EXIT) {
|
if (ret & PYEXEC_FORCED_EXIT) {
|
||||||
goto soft_reset_exit;
|
goto soft_reset_exit;
|
||||||
}
|
}
|
||||||
if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) {
|
if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL && ret != 0) {
|
||||||
ret = pyexec_file_if_exists("main.py");
|
ret = pyexec_file_if_exists("main.py");
|
||||||
if (ret & PYEXEC_FORCED_EXIT) {
|
if (ret & PYEXEC_FORCED_EXIT) {
|
||||||
goto soft_reset_exit;
|
goto soft_reset_exit;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user