summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/main.c
diff options
context:
space:
mode:
authorDave Hylands <dhylands@gmail.com>2015-12-05 23:49:43 -0800
committerDamien George <damien.p.george@gmail.com>2015-12-07 15:11:42 +0000
commitacc208418bb1fd1f37f64cdbddc6be7a8eaeb4b8 (patch)
tree74e691b60ed9be83bf6a0a003fffe903be6acdf3 /stmhal/main.c
parent2b7236d249bc87be1f9967a46693683c8722c351 (diff)
downloadmicropython-acc208418bb1fd1f37f64cdbddc6be7a8eaeb4b8.tar.gz
micropython-acc208418bb1fd1f37f64cdbddc6be7a8eaeb4b8.zip
stmhal: Execute boot.py and main.py when formatting the file system.
When you use the USER button to perform a filesystem reset at boot time then it wipes out the filesystem and creates a new boot.py and main.py. With this patch these files are executed after formatting, ensuring that pyb and machine modules get imported.
Diffstat (limited to 'stmhal/main.c')
-rw-r--r--stmhal/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/stmhal/main.c b/stmhal/main.c
index 2eb5a53385..733d3a19b4 100644
--- a/stmhal/main.c
+++ b/stmhal/main.c
@@ -529,7 +529,7 @@ soft_reset:
// run boot.py, if it exists
// TODO perhaps have pyb.reboot([bootpy]) function to soft-reboot and execute custom boot.py
- if (reset_mode == 1) {
+ if (reset_mode == 1 || reset_mode == 3) {
const char *boot_py = "boot.py";
FRESULT res = f_stat(boot_py, NULL);
if (res == FR_OK) {
@@ -585,7 +585,7 @@ soft_reset:
// At this point everything is fully configured and initialised.
// Run the main script from the current directory.
- if (reset_mode == 1 && pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) {
+ if ((reset_mode == 1 || reset_mode == 3) && pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) {
const char *main_py;
if (MP_STATE_PORT(pyb_config_main) == MP_OBJ_NULL) {
main_py = "main.py";