aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAyke van Laethem2017-11-15 00:28:30 +0100
committerDamien George2018-07-18 17:12:25 +1000
commitd9fb8c2585500bbc256d449e146b44d40284f2d5 (patch)
tree52524dd59ded8c456a71d36c01d76ccae177d095
parent66e39d6a4ec91e56c1111e4fc6d51717b266be43 (diff)
nrf/main: Run boot.py and main.py on startup.
-rw-r--r--ports/nrf/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ports/nrf/main.c b/ports/nrf/main.c
index 8acd758da..5ea03a2a2 100644
--- a/ports/nrf/main.c
+++ b/ports/nrf/main.c
@@ -184,6 +184,16 @@ pin_init0();
MP_PARSE_FILE_INPUT);
#endif
+#if MICROPY_VFS || MICROPY_HW_HAS_BUILTIN_FLASH
+ // run boot.py and main.py if they exist.
+ if (mp_import_stat("boot.py") == MP_IMPORT_STAT_FILE) {
+ pyexec_file("boot.py");
+ }
+ if (mp_import_stat("main.py") == MP_IMPORT_STAT_FILE) {
+ pyexec_file("main.py");
+ }
+#endif
+
// Main script is finished, so now go into REPL mode.
// The REPL mode can change, or it can request a soft reset.
int ret_code = 0;