From 6e87aeb8419e8c5fe009577a3b1bb18254a35b79 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 10 Apr 2016 14:12:52 +0300 Subject: 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. --- esp8266/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'esp8266/main.c') 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 } -- cgit v1.2.3