diff --git a/components/fatfs/Kconfig b/components/fatfs/Kconfig index 2c74dcf675..dbdb76f15f 100644 --- a/components/fatfs/Kconfig +++ b/components/fatfs/Kconfig @@ -253,4 +253,15 @@ menu "FAT Filesystem support" If enabled, the whole link operation (including file copying) is performed under lock. This ensures that the link operation is atomic, but may cause performance for large files. It may create less fragmented file copy. + config FATFS_USE_DYN_BUFFERS + bool "Use dynamic buffers" + depend on CONFIG_WL_SECTOR_SIZE_4096 + default y + help + If enabled, the buffers used by FATFS will be allocated separately from the rest of the structure. + This option is useful when using multiple FATFS instances with different + sector sizes, as the buffers will be allocated according to the sector size. + If disabled, the greatest sector size will be used for all FATFS instances. + (In most cases, this would be the sector size of Wear Levelling library) + This might cause more memory to be used than necessary. endmenu diff --git a/components/fatfs/src/ffconf.h b/components/fatfs/src/ffconf.h index fc9ed23a9a..43238ce2b7 100644 --- a/components/fatfs/src/ffconf.h +++ b/components/fatfs/src/ffconf.h @@ -311,7 +311,7 @@ / The FF_FS_TIMEOUT defines timeout period in unit of O/S time tick. */ -#define FF_USE_DYN_BUFFER 0 +#define FF_USE_DYN_BUFFER CONFIG_FATFS_USE_DYN_BUFFERS /* The option FF_USE_DYN_BUFFER controls source of size used for buffers in the FS and FIL objects. / / 0: Disable dynamic buffer size and use static size buffers defined by FF_MAX_SS.