I assume you know this, but this is not really a good idea, you're going to end up in a boot loop you can't get out of without erasing the flash.
I'm curious why you'd want to do this, and specifically in boot.py rather than main.py?
That being said, looks like boot.py is handled slightly different from the repl and main.py, which isn't a complete answer to your question, but shines light on it.
machine.
soft_reset() raises a SystemExit error, rather than executes the
soft_reset. The
soft_reset is in main.c.
Code: Select all
ports/esp32/modmachine.c
STATIC mp_obj_t machine_soft_reset(void) {
pyexec_system_exit = PYEXEC_FORCED_EXIT;
mp_raise_type(&mp_type_SystemExit);
}
When done from main.py or the repl, it looks like it's checked which triggers the actual
soft_reset. when executing boot.py, I don't think the particular error is checked / acted on.
Code: Select all
ports/esp32/main.py:119-126
pyexec_frozen_module("_boot.py");
pyexec_file_if_exists("boot.py");
if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) {
int ret = pyexec_file_if_exists("main.py");
if (ret & PYEXEC_FORCED_EXIT) {
goto soft_reset_exit;
}
}
notice how the return from pyexec_file_if_exists is not checked for boot.py, but is for main.py.