Skip to content

Commit b4070ee

Browse files
committed
esp8266: Allow to build without FatFs support again.
1 parent 2f02302 commit b4070ee

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

esp8266/main.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ STATIC void mp_reset(void) {
4848
mp_init();
4949
mp_obj_list_init(mp_sys_path, 0);
5050
mp_obj_list_init(mp_sys_argv, 0);
51+
#if MICROPY_VFS_FAT
5152
memset(MP_STATE_PORT(fs_user_mount), 0, sizeof(MP_STATE_PORT(fs_user_mount)));
53+
#endif
5254
MP_STATE_PORT(mp_kbd_exception) = mp_obj_new_exception(&mp_type_KeyboardInterrupt);
5355
#if MICROPY_MODULE_FROZEN
5456
pyexec_frozen_module("boot");
@@ -77,11 +79,21 @@ mp_lexer_t *fat_vfs_lexer_new_from_file(const char *filename);
7779
mp_import_stat_t fat_vfs_import_stat(const char *path);
7880

7981
mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
82+
#if MICROPY_VFS_FAT
8083
return fat_vfs_lexer_new_from_file(filename);
84+
#else
85+
(void)filename;
86+
return NULL;
87+
#endif
8188
}
8289

8390
mp_import_stat_t mp_import_stat(const char *path) {
91+
#if MICROPY_VFS_FAT
8492
return fat_vfs_import_stat(path);
93+
#else
94+
(void)path;
95+
return MP_IMPORT_STAT_NO_EXIST;
96+
#endif
8597
}
8698

8799
mp_obj_t mp_builtin_open(uint n_args, const mp_obj_t *args, mp_map_t *kwargs) {

esp8266/moduos.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ STATIC mp_obj_t os_uname(void) {
6969
}
7070
STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname);
7171

72+
#if MICROPY_VFS_FAT
7273
STATIC mp_obj_t vfs_proxy_call(qstr method_name, mp_uint_t n_args, const mp_obj_t *args) {
7374
if (MP_STATE_PORT(fs_user_mount)[0] == NULL) {
7475
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(ENODEV)));
@@ -89,14 +90,15 @@ STATIC mp_obj_t os_remove(mp_obj_t path_in) {
8990
return vfs_proxy_call(MP_QSTR_remove, 1, &path_in);
9091
}
9192
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_remove_obj, os_remove);
93+
#endif
9294

9395
STATIC const mp_rom_map_elem_t os_module_globals_table[] = {
9496
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) },
9597
{ MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&os_uname_obj) },
96-
{ MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&os_listdir_obj) },
97-
{ MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&os_remove_obj) },
9898
#if MICROPY_VFS_FAT
9999
{ MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) },
100+
{ MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&os_listdir_obj) },
101+
{ MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&os_remove_obj) },
100102
#endif
101103
};
102104

0 commit comments

Comments
 (0)