diff --git a/esp8266/Makefile b/esp8266/Makefile index 1836e7eb4a..9a15c547b0 100644 --- a/esp8266/Makefile +++ b/esp8266/Makefile @@ -75,6 +75,7 @@ SRC_C = \ utils.c \ ets_alt_task.c \ $(BUILD)/frozen.c \ + fatfs_port.o \ STM_SRC_C = $(addprefix stmhal/,\ pybstdio.c \ @@ -109,6 +110,8 @@ LIB_SRC_C = $(addprefix lib/,\ timeutils/timeutils.c \ utils/pyexec.c \ utils/printf.c \ + fatfs/ff.c \ + fatfs/option/ccsbcs.c \ ) SRC_S = \ diff --git a/esp8266/fatfs_port.c b/esp8266/fatfs_port.c new file mode 100644 index 0000000000..c62ae2e7dc --- /dev/null +++ b/esp8266/fatfs_port.c @@ -0,0 +1,6 @@ +#include "lib/fatfs/ff.h" +#include "lib/fatfs/diskio.h" + +DWORD get_fattime(void) { + return 0; +} diff --git a/esp8266/moduos.c b/esp8266/moduos.c index 56827d12f4..4456e4136e 100644 --- a/esp8266/moduos.c +++ b/esp8266/moduos.c @@ -34,6 +34,8 @@ #include "genhdr/mpversion.h" #include "user_interface.h" +extern const mp_obj_type_t mp_fat_vfs_type; + STATIC const qstr os_uname_info_fields[] = { MP_QSTR_sysname, MP_QSTR_nodename, MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine @@ -68,6 +70,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname); STATIC const mp_map_elem_t os_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_uos) }, { MP_OBJ_NEW_QSTR(MP_QSTR_uname), (mp_obj_t)&os_uname_obj }, + #if MICROPY_VFS_FAT + { MP_ROM_QSTR(MP_QSTR_VfsFat), (mp_obj_t)&mp_fat_vfs_type }, + #endif }; STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); diff --git a/esp8266/mpconfigport.h b/esp8266/mpconfigport.h index aee1220f66..40d51e38d3 100644 --- a/esp8266/mpconfigport.h +++ b/esp8266/mpconfigport.h @@ -59,6 +59,14 @@ #define MICROPY_MODULE_FROZEN (1) #define MICROPY_MODULE_FROZEN_LEXER mp_lexer_new_from_str32 +#define MICROPY_FATFS_ENABLE_LFN (1) +#define MICROPY_FATFS_RPATH (2) +#define MICROPY_FATFS_VOLUMES (2) +#define MICROPY_FATFS_MAX_SS (4096) +#define MICROPY_FATFS_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */ +#define MICROPY_FSUSERMOUNT (1) +#define MICROPY_VFS_FAT (1) + #define MICROPY_EVENT_POLL_HOOK {ets_event_poll();} // type definitions for the specific machine