Skip to content

Commit 6b0c882

Browse files
committed
extmod/vfs_fat_file: Reusable FatFs module, move from stmhal/file.
1 parent 8cb78e0 commit 6b0c882

File tree

8 files changed

+11
-7
lines changed

8 files changed

+11
-7
lines changed

extmod/vfs_fat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "py/runtime.h"
3333
#include "lib/fatfs/ff.h"
3434
#include "lib/fatfs/diskio.h"
35-
#include "stmhal/file.h"
35+
#include "extmod/vfs_fat_file.h"
3636
#include "fsusermount.h"
3737

3838
#define mp_obj_fat_vfs_t fs_user_mount_t

stmhal/file.c renamed to extmod/vfs_fat_file.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,17 @@
2424
* THE SOFTWARE.
2525
*/
2626

27+
#include "py/mpconfig.h"
28+
#if MICROPY_FSUSERMOUNT
29+
2730
#include <stdio.h>
2831
#include <errno.h>
2932

3033
#include "py/nlr.h"
3134
#include "py/runtime.h"
3235
#include "py/stream.h"
3336
#include "lib/fatfs/ff.h"
34-
#include "file.h"
37+
#include "extmod/vfs_fat_file.h"
3538

3639
#if MICROPY_VFS_FAT
3740
#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
284287
mp_arg_parse_all(n_args, args, kwargs, FILE_OPEN_NUM_ARGS, file_open_args, arg_vals);
285288
return file_open(&mp_type_textio, arg_vals);
286289
}
290+
291+
#endif // MICROPY_FSUSERMOUNT
File renamed without changes.

py/py.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ PY_O_BASENAME = \
172172
../extmod/fsusermount.o \
173173
../extmod/vfs_fat.o \
174174
../extmod/vfs_fat_diskio.o \
175+
../extmod/vfs_fat_file.o \
175176
../extmod/moduos_dupterm.o \
176177

177178
# prepend the build destination prefix to the py object files

stmhal/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ SRC_C = \
153153
rtc.c \
154154
flash.c \
155155
storage.c \
156-
file.c \
157156
builtin_open.c \
158157
sdcard.c \
159158
fatfs_port.c \

stmhal/builtin_open.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
*/
2626

2727
#include "py/runtime.h"
28-
#include "file.h"
28+
#include "extmod/vfs_fat_file.h"
2929

3030
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, fatfs_builtin_open);

stmhal/moduos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "timeutils.h"
3737
#include "rng.h"
3838
#include "uart.h"
39-
#include "file.h"
39+
#include "extmod/vfs_fat_file.h"
4040
#include "sdcard.h"
4141
#include "extmod/fsusermount.h"
4242
#include "portmodules.h"

unix/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ SRC_C = \
148148
$(SRC_MOD)
149149

150150
STMHAL_SRC_C = \
151-
stmhal/ffconf.c \
152-
stmhal/file.c
151+
stmhal/ffconf.c
153152

154153
# Include builtin package manager in the standard build (and coverage)
155154
ifeq ($(PROG),micropython)

0 commit comments

Comments
 (0)