aboutsummaryrefslogtreecommitdiff
path: root/ports/teensy
diff options
context:
space:
mode:
authorDamien George2019-04-26 15:22:14 +1000
committerDamien George2019-04-26 15:22:14 +1000
commit0646e607b537b43901db53c743ec2011a375f5e2 (patch)
treec5049313f11beabef7936d1ec264f0416cdee6d0 /ports/teensy
parent06a532c227c2f37fc190deb84970fdfeaaf37d6a (diff)
ports: Convert to use pyexec_file_if_exists() to execute boot/main.py.
The stm32 and nrf ports already had the behaviour that they would first check if the script exists before executing it, and this patch makes all other ports work the same way. This helps when developing apps because it's hard to tell (when unconditionally trying to execute the scripts) if the resulting OSError at boot up comes from missing boot.py or main.py, or from some other error. And it's not really an error if these scripts don't exist.
Diffstat (limited to 'ports/teensy')
-rw-r--r--ports/teensy/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/teensy/main.c b/ports/teensy/main.c
index ad98a4364..1f529f589 100644
--- a/ports/teensy/main.c
+++ b/ports/teensy/main.c
@@ -302,7 +302,7 @@ soft_reset:
#if MICROPY_MODULE_FROZEN
pyexec_frozen_module("boot.py");
#else
- if (!pyexec_file("/boot.py")) {
+ if (!pyexec_file_if_exists("/boot.py")) {
flash_error(4);
}
#endif
@@ -322,7 +322,7 @@ soft_reset:
} else {
vstr_add_str(vstr, mp_obj_str_get_str(pyb_config_main));
}
- if (!pyexec_file(vstr_null_terminated_str(vstr))) {
+ if (!pyexec_file_if_exists(vstr_null_terminated_str(vstr))) {
flash_error(3);
}
vstr_free(vstr);