Skip to content

Commit 374654f

Browse files
committed
esp8266: Enable FatFs support.
1 parent fe9bc0c commit 374654f

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

esp8266/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ SRC_C = \
7575
utils.c \
7676
ets_alt_task.c \
7777
$(BUILD)/frozen.c \
78+
fatfs_port.o \
7879

7980
STM_SRC_C = $(addprefix stmhal/,\
8081
pybstdio.c \
@@ -109,6 +110,8 @@ LIB_SRC_C = $(addprefix lib/,\
109110
timeutils/timeutils.c \
110111
utils/pyexec.c \
111112
utils/printf.c \
113+
fatfs/ff.c \
114+
fatfs/option/ccsbcs.c \
112115
)
113116

114117
SRC_S = \

esp8266/fatfs_port.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "lib/fatfs/ff.h"
2+
#include "lib/fatfs/diskio.h"
3+
4+
DWORD get_fattime(void) {
5+
return 0;
6+
}

esp8266/moduos.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
#include "genhdr/mpversion.h"
3535
#include "user_interface.h"
3636

37+
extern const mp_obj_type_t mp_fat_vfs_type;
38+
3739
STATIC const qstr os_uname_info_fields[] = {
3840
MP_QSTR_sysname, MP_QSTR_nodename,
3941
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);
6870
STATIC const mp_map_elem_t os_module_globals_table[] = {
6971
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_uos) },
7072
{ MP_OBJ_NEW_QSTR(MP_QSTR_uname), (mp_obj_t)&os_uname_obj },
73+
#if MICROPY_VFS_FAT
74+
{ MP_ROM_QSTR(MP_QSTR_VfsFat), (mp_obj_t)&mp_fat_vfs_type },
75+
#endif
7176
};
7277

7378
STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table);

esp8266/mpconfigport.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@
5959
#define MICROPY_MODULE_FROZEN (1)
6060
#define MICROPY_MODULE_FROZEN_LEXER mp_lexer_new_from_str32
6161

62+
#define MICROPY_FATFS_ENABLE_LFN (1)
63+
#define MICROPY_FATFS_RPATH (2)
64+
#define MICROPY_FATFS_VOLUMES (2)
65+
#define MICROPY_FATFS_MAX_SS (4096)
66+
#define MICROPY_FATFS_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
67+
#define MICROPY_FSUSERMOUNT (1)
68+
#define MICROPY_VFS_FAT (1)
69+
6270
#define MICROPY_EVENT_POLL_HOOK {ets_event_poll();}
6371

6472
// type definitions for the specific machine

0 commit comments

Comments
 (0)