Configure and make fatfs build.

This commit is contained in:
David Given
2022-08-26 00:33:38 +02:00
parent 529bd6fa33
commit 9007e264cf
5 changed files with 28 additions and 14 deletions

12
dep/fatfs/build.mk Normal file
View File

@@ -0,0 +1,12 @@
FATFS_SRCS = \
dep/fatfs/source/ff.c \
dep/fatfs/source/ffsystem.c \
dep/fatfs/source/ffunicode.c \
FATFS_OBJS = $(patsubst %.c, $(OBJDIR)/%.o, $(FATFS_SRCS))
$(FATFS_OBJS): CFLAGS += -Idep/fatfs/source
FATFS_LIB = $(OBJDIR)/libfatfs.a
$(FATFS_LIB): $(FATFS_OBJS)
FATFS_CFLAGS =
FATFS_LDFLAGS = $(FATFS_LIB)

View File

@@ -256,14 +256,14 @@
/* Definitions of sector size */
#if (FF_MAX_SS < FF_MIN_SS) || (FF_MAX_SS != 512 && FF_MAX_SS != 1024 && FF_MAX_SS != 2048 && FF_MAX_SS != 4096) || (FF_MIN_SS != 512 && FF_MIN_SS != 1024 && FF_MIN_SS != 2048 && FF_MIN_SS != 4096)
#error Wrong sector size configuration
#endif
#if FF_MAX_SS == FF_MIN_SS
#define SS(fs) ((UINT)FF_MAX_SS) /* Fixed sector size */
#else
//#if (FF_MAX_SS < FF_MIN_SS) || (FF_MAX_SS != 512 && FF_MAX_SS != 1024 && FF_MAX_SS != 2048 && FF_MAX_SS != 4096) || (FF_MIN_SS != 512 && FF_MIN_SS != 1024 && FF_MIN_SS != 2048 && FF_MIN_SS != 4096)
//#error Wrong sector size configuration
//#endif
//#if FF_MAX_SS == FF_MIN_SS
//#define SS(fs) ((UINT)FF_MAX_SS) /* Fixed sector size */
//#else
#define SS(fs) ((fs)->ssize) /* Variable sector size */
#endif
//#endif
/* Timestamp */

View File

@@ -25,12 +25,12 @@
/ 3: f_lseek() function is removed in addition to 2. */
#define FF_USE_FIND 0
#define FF_USE_FIND 1
/* This option switches filtered directory read functions, f_findfirst() and
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
#define FF_USE_MKFS 0
#define FF_USE_MKFS 1
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
@@ -47,7 +47,7 @@
/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */
#define FF_USE_LABEL 0
#define FF_USE_LABEL 1
/* This option switches volume label functions, f_getlabel() and f_setlabel().
/ (0:Disable or 1:Enable) */
@@ -84,7 +84,7 @@
/ Locale and Namespace Configurations
/---------------------------------------------------------------------------*/
#define FF_CODE_PAGE 932
#define FF_CODE_PAGE 0
/* This option specifies the OEM code page to be used on the target system.
/ Incorrect code page setting can cause a file open failure.
/
@@ -193,8 +193,8 @@
/ funciton will be available. */
#define FF_MIN_SS 512
#define FF_MAX_SS 512
#define FF_MIN_SS 128
#define FF_MAX_SS 4096
/* This set of options configures the range of sector size to be supported. (512,
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
/ harddisk, but a larger value may be required for on-board flash memory and some
@@ -224,7 +224,7 @@
/ System Configurations
/---------------------------------------------------------------------------*/
#define FF_FS_TINY 0
#define FF_FS_TINY 1
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes.
/ Instead of private sector buffer eliminated from the file object, common sector