esp8266: Implement multistage bootstrap sequence.

Upon start-up, _boot module is executed from frozen files to do early
initialization, e.g. create and mount the flash filesystem. Then
"boot.py" is executed if it exists in the filesystem. Finally, "main.py"
is executed if exists to allow start-on-boot user applications.

This allows a user to make a custom boot file or startup application
without recompiling the firmware, while letting to do early initialization
in Python code.

Based on RFC https://github.com/micropython/micropython/issues/1955.
This commit is contained in:
Damien George 2016-04-10 14:12:52 +03:00 committed by Paul Sokolovsky
parent b69f798c92
commit 6e87aeb841
1 changed files with 3 additions and 1 deletions

View File

@ -54,7 +54,9 @@ STATIC void mp_reset(void) {
MP_STATE_PORT(mp_kbd_exception) = mp_obj_new_exception(&mp_type_KeyboardInterrupt);
MP_STATE_PORT(term_obj) = MP_OBJ_NULL;
#if MICROPY_MODULE_FROZEN
pyexec_frozen_module("boot");
pyexec_frozen_module("_boot");
pyexec_file("boot.py");
pyexec_file("main.py");
#endif
}