Skip to content

Commit 95f19b4

Browse files
author
Daniel Campora
committed
cc3200: Remove duplicated checks for boot.py and main.py existency.
1 parent 90d7c4e commit 95f19b4

1 file changed

Lines changed: 15 additions & 23 deletions

File tree

cc3200/mptask.c

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ void TASK_Micropython (void *pvParameters) {
105105
uint32_t sp = gc_helper_get_sp();
106106
gc_collect_init (sp);
107107
bool safeboot = false;
108-
FRESULT res;
109108

110109
mptask_pre_init();
111110

@@ -184,18 +183,14 @@ void TASK_Micropython (void *pvParameters) {
184183
MP_STATE_PORT(pyb_config_main) = MP_OBJ_NULL;
185184

186185
if (!safeboot) {
187-
// run boot.py, if it exists
188-
const char *boot_py = "boot.py";
189-
res = f_stat(boot_py, NULL);
190-
if (res == FR_OK) {
191-
int ret = pyexec_file(boot_py);
192-
if (ret & PYEXEC_FORCED_EXIT) {
193-
goto soft_reset_exit;
194-
}
195-
if (!ret) {
196-
// flash the system led
197-
mperror_signal_error();
198-
}
186+
// run boot.py
187+
int ret = pyexec_file("boot.py");
188+
if (ret & PYEXEC_FORCED_EXIT) {
189+
goto soft_reset_exit;
190+
}
191+
if (!ret) {
192+
// flash the system led
193+
mperror_signal_error();
199194
}
200195
}
201196

@@ -214,16 +209,13 @@ void TASK_Micropython (void *pvParameters) {
214209
} else {
215210
main_py = mp_obj_str_get_str(MP_STATE_PORT(pyb_config_main));
216211
}
217-
res = f_stat(main_py, NULL);
218-
if (res == FR_OK) {
219-
int ret = pyexec_file(main_py);
220-
if (ret & PYEXEC_FORCED_EXIT) {
221-
goto soft_reset_exit;
222-
}
223-
if (!ret) {
224-
// flash the system led
225-
mperror_signal_error();
226-
}
212+
int ret = pyexec_file(main_py);
213+
if (ret & PYEXEC_FORCED_EXIT) {
214+
goto soft_reset_exit;
215+
}
216+
if (!ret) {
217+
// flash the system led
218+
mperror_signal_error();
227219
}
228220
}
229221
}

0 commit comments

Comments
 (0)