py/runtime: Zero out fs_user_mount array in mp_init.
There's no need to force ports to copy-and-paste this initialisation code. If FSUSERMOUNT is enabled then this zeroing out must be done.
This commit is contained in:
parent
e83f140463
commit
e8f2db7da3
|
@ -52,9 +52,6 @@ STATIC void mp_reset(void) {
|
||||||
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_lib));
|
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_lib));
|
||||||
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_));
|
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_));
|
||||||
mp_obj_list_init(mp_sys_argv, 0);
|
mp_obj_list_init(mp_sys_argv, 0);
|
||||||
#if MICROPY_VFS_FAT
|
|
||||||
memset(MP_STATE_PORT(fs_user_mount), 0, sizeof(MP_STATE_PORT(fs_user_mount)));
|
|
||||||
#endif
|
|
||||||
MP_STATE_PORT(mp_kbd_exception) = mp_obj_new_exception(&mp_type_KeyboardInterrupt);
|
MP_STATE_PORT(mp_kbd_exception) = mp_obj_new_exception(&mp_type_KeyboardInterrupt);
|
||||||
MP_STATE_PORT(term_obj) = MP_OBJ_NULL;
|
MP_STATE_PORT(term_obj) = MP_OBJ_NULL;
|
||||||
MP_STATE_PORT(dupterm_arr_obj) = MP_OBJ_NULL;
|
MP_STATE_PORT(dupterm_arr_obj) = MP_OBJ_NULL;
|
||||||
|
|
|
@ -91,6 +91,11 @@ void mp_init(void) {
|
||||||
MP_STATE_VM(mp_module_builtins_override_dict) = NULL;
|
MP_STATE_VM(mp_module_builtins_override_dict) = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MICROPY_FSUSERMOUNT
|
||||||
|
// zero out the pointers to the user-mounted devices
|
||||||
|
memset(MP_STATE_VM(fs_user_mount), 0, sizeof(MP_STATE_VM(fs_user_mount)));
|
||||||
|
#endif
|
||||||
|
|
||||||
#if MICROPY_PY_THREAD_GIL
|
#if MICROPY_PY_THREAD_GIL
|
||||||
mp_thread_mutex_init(&MP_STATE_VM(gil_mutex));
|
mp_thread_mutex_init(&MP_STATE_VM(gil_mutex));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -439,9 +439,6 @@ soft_reset:
|
||||||
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash_slash_lib));
|
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash_slash_lib));
|
||||||
mp_obj_list_init(mp_sys_argv, 0);
|
mp_obj_list_init(mp_sys_argv, 0);
|
||||||
|
|
||||||
// zero out the pointers to the mounted devices
|
|
||||||
memset(MP_STATE_PORT(fs_user_mount), 0, sizeof(MP_STATE_PORT(fs_user_mount)));
|
|
||||||
|
|
||||||
// Initialise low-level sub-systems. Here we need to very basic things like
|
// Initialise low-level sub-systems. Here we need to very basic things like
|
||||||
// zeroing out memory and resetting any of the sub-systems. Following this
|
// zeroing out memory and resetting any of the sub-systems. Following this
|
||||||
// we can run Python scripts (eg boot.py), but anything that is configurable
|
// we can run Python scripts (eg boot.py), but anything that is configurable
|
||||||
|
|
Loading…
Reference in New Issue