summaryrefslogtreecommitdiffstatshomepage
path: root/esp8266/main.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-04-10 14:12:52 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-04-10 14:24:41 +0300
commit6e87aeb8419e8c5fe009577a3b1bb18254a35b79 (patch)
treee8260e9d7fc2df036e4b66e12702e8d8629998ac /esp8266/main.c
parentb69f798c92cfe9685382a8b5594dc62db77706a7 (diff)
downloadmicropython-6e87aeb8419e8c5fe009577a3b1bb18254a35b79.tar.gz
micropython-6e87aeb8419e8c5fe009577a3b1bb18254a35b79.zip
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.
Diffstat (limited to 'esp8266/main.c')
-rw-r--r--esp8266/main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/esp8266/main.c b/esp8266/main.c
index 1701ef69f9..bbd0b4dfd8 100644
--- a/esp8266/main.c
+++ b/esp8266/main.c
@@ -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
}