unix: Enable VfsFat support.

crypto-aes
Paul Sokolovsky 7 years ago
parent e9be6a378c
commit 8a43a41b3a

@ -170,6 +170,7 @@ PY_O_BASENAME = \
../extmod/modussl.o \
../extmod/modurandom.o \
../extmod/fsusermount.o \
../extmod/vfs_fat.o \
../extmod/moduos_dupterm.o \
# prepend the build destination prefix to the py object files

@ -144,8 +144,14 @@ SRC_C = \
moduselect.c \
alloc.c \
coverage.c \
fatfs_port.c \
$(SRC_MOD)
STMHAL_SRC_C = \
stmhal/diskio.c \
stmhal/ffconf.c \
stmhal/file.c
# Include builtin package manager in the standard build (and coverage)
ifeq ($(PROG),micropython)
SRC_C += $(BUILD)/_frozen_upip.c
@ -160,11 +166,14 @@ endif
LIB_SRC_C = $(addprefix lib/,\
$(LIB_SRC_C_EXTRA) \
utils/printf.c \
fatfs/ff.c \
fatfs/option/ccsbcs.c \
)
OBJ = $(PY_O)
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(STMHAL_SRC_C:.c=.o))
include ../py/mkrules.mk

@ -0,0 +1,6 @@
#include "lib/fatfs/ff.h"
#include "lib/fatfs/diskio.h"
DWORD get_fattime(void) {
return 0;
}

@ -39,6 +39,14 @@
#include "py/objtuple.h"
#include "extmod/misc.h"
// Can't include this, as FATFS structure definition is required,
// and FatFs header defining it conflicts with POSIX.
//#include "extmod/fsusermount.h"
MP_DECLARE_CONST_FUN_OBJ(fsuser_mount_obj);
MP_DECLARE_CONST_FUN_OBJ(fsuser_umount_obj);
MP_DECLARE_CONST_FUN_OBJ(fsuser_mkfs_obj);
extern const mp_obj_type_t mp_fat_vfs_type;
#ifdef __ANDROID__
#define USE_STATFS 1
#endif
@ -228,6 +236,14 @@ STATIC const mp_rom_map_elem_t mp_module_os_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mod_os_getenv_obj) },
{ MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mod_os_mkdir_obj) },
{ MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mod_os_ilistdir_obj) },
#if MICROPY_FSUSERMOUNT
{ MP_ROM_QSTR(MP_QSTR_vfs_mount), MP_ROM_PTR(&fsuser_mount_obj) },
{ MP_ROM_QSTR(MP_QSTR_vfs_umount), MP_ROM_PTR(&fsuser_umount_obj) },
{ MP_ROM_QSTR(MP_QSTR_vfs_mkfs), MP_ROM_PTR(&fsuser_mkfs_obj) },
#endif
#if MICROPY_VFS_FAT
{ MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) },
#endif
#if MICROPY_PY_OS_DUPTERM
{ MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&mp_uos_dupterm_obj) },
#endif

@ -112,6 +112,16 @@
#define MICROPY_MACHINE_MEM_GET_READ_ADDR mod_machine_mem_get_addr
#define MICROPY_MACHINE_MEM_GET_WRITE_ADDR mod_machine_mem_get_addr
#define MICROPY_FATFS_ENABLE_LFN (1)
#define MICROPY_FATFS_RPATH (2)
// Can't have less than 3 values because diskio.h uses volume numbers
// as volume types and PD_USER == 2.
#define MICROPY_FATFS_VOLUMES (3)
#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 to MICROPY_ERROR_REPORTING_DETAILED to get function, etc.
// names in exception messages (may require more RAM).
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_DETAILED)
@ -254,6 +264,8 @@ extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
#define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[50]; \
mp_obj_t keyboard_interrupt_obj; \
/* for user-mountable block device (max fixed at compile time) */ \
struct _fs_user_mount_t *fs_user_mount[MICROPY_FATFS_VOLUMES]; \
void *mmap_region_head; \
// We need to provide a declaration/definition of alloca()

@ -45,6 +45,14 @@ Q(getenv)
Q(mkdir)
Q(ilistdir)
Q(errno)
#if MICROPY_FSUSERMOUNT
Q(vfs_mount)
Q(vfs_umount)
Q(vfs_mkfs)
#endif
#if MICROPY_VFS_FAT
Q(VfsFat)
#endif
#if MICROPY_PY_OS_DUPTERM
Q(dupterm)
#endif

Loading…
Cancel
Save