Commit 6b0c8825 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

extmod/vfs_fat_file: Reusable FatFs module, move from stmhal/file.

parent 8cb78e0e
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "lib/fatfs/ff.h" #include "lib/fatfs/ff.h"
#include "lib/fatfs/diskio.h" #include "lib/fatfs/diskio.h"
#include "stmhal/file.h" #include "extmod/vfs_fat_file.h"
#include "fsusermount.h" #include "fsusermount.h"
#define mp_obj_fat_vfs_t fs_user_mount_t #define mp_obj_fat_vfs_t fs_user_mount_t
......
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "py/mpconfig.h"
#if MICROPY_FSUSERMOUNT
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
...@@ -31,7 +34,7 @@ ...@@ -31,7 +34,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "py/stream.h" #include "py/stream.h"
#include "lib/fatfs/ff.h" #include "lib/fatfs/ff.h"
#include "file.h" #include "extmod/vfs_fat_file.h"
#if MICROPY_VFS_FAT #if MICROPY_VFS_FAT
#define mp_type_fileio fatfs_type_fileio #define mp_type_fileio fatfs_type_fileio
...@@ -284,3 +287,5 @@ mp_obj_t fatfs_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw ...@@ -284,3 +287,5 @@ mp_obj_t fatfs_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw
mp_arg_parse_all(n_args, args, kwargs, FILE_OPEN_NUM_ARGS, file_open_args, arg_vals); mp_arg_parse_all(n_args, args, kwargs, FILE_OPEN_NUM_ARGS, file_open_args, arg_vals);
return file_open(&mp_type_textio, arg_vals); return file_open(&mp_type_textio, arg_vals);
} }
#endif // MICROPY_FSUSERMOUNT
...@@ -172,6 +172,7 @@ PY_O_BASENAME = \ ...@@ -172,6 +172,7 @@ PY_O_BASENAME = \
../extmod/fsusermount.o \ ../extmod/fsusermount.o \
../extmod/vfs_fat.o \ ../extmod/vfs_fat.o \
../extmod/vfs_fat_diskio.o \ ../extmod/vfs_fat_diskio.o \
../extmod/vfs_fat_file.o \
../extmod/moduos_dupterm.o \ ../extmod/moduos_dupterm.o \
# prepend the build destination prefix to the py object files # prepend the build destination prefix to the py object files
......
...@@ -153,7 +153,6 @@ SRC_C = \ ...@@ -153,7 +153,6 @@ SRC_C = \
rtc.c \ rtc.c \
flash.c \ flash.c \
storage.c \ storage.c \
file.c \
builtin_open.c \ builtin_open.c \
sdcard.c \ sdcard.c \
fatfs_port.c \ fatfs_port.c \
......
...@@ -25,6 +25,6 @@ ...@@ -25,6 +25,6 @@
*/ */
#include "py/runtime.h" #include "py/runtime.h"
#include "file.h" #include "extmod/vfs_fat_file.h"
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, fatfs_builtin_open); MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, fatfs_builtin_open);
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "timeutils.h" #include "timeutils.h"
#include "rng.h" #include "rng.h"
#include "uart.h" #include "uart.h"
#include "file.h" #include "extmod/vfs_fat_file.h"
#include "sdcard.h" #include "sdcard.h"
#include "extmod/fsusermount.h" #include "extmod/fsusermount.h"
#include "portmodules.h" #include "portmodules.h"
......
...@@ -148,8 +148,7 @@ SRC_C = \ ...@@ -148,8 +148,7 @@ SRC_C = \
$(SRC_MOD) $(SRC_MOD)
STMHAL_SRC_C = \ STMHAL_SRC_C = \
stmhal/ffconf.c \ stmhal/ffconf.c
stmhal/file.c
# Include builtin package manager in the standard build (and coverage) # Include builtin package manager in the standard build (and coverage)
ifeq ($(PROG),micropython) ifeq ($(PROG),micropython)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment