Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions components/dfs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,23 @@ endif
help
If you use some spi nor flash for fatfs, please set this the erase sector size, for example 4096.

config RT_DFS_ELM_NFATS
int "Number of FATs (File Allocation Tables) on the volume"
range 1 2
default 1
help
Number of copies of the FAT table. Setting 1 saves space while 2
provides redundancy for fault tolerance. Used by f_mkfs().

config RT_DFS_ELM_CLUSTER_SIZE
int "Cluster size in bytes (0 = auto)"
default 0
help
Cluster size (allocation unit size) used by f_mkfs().
Set to 0 to let f_mkfs auto-select based on volume size.
Common values: 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536.
Must be a power of 2 and >= sector size.

config RT_DFS_ELM_USE_ERASE
bool "Enable sector erase feature"
default n
Expand Down
6 changes: 6 additions & 0 deletions components/dfs/dfs_v1/filesystems/elmfat/dfs_elm.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ int dfs_elm_mkfs(rt_device_t dev_id, const char *fs_name)
/* [IN] Size of working buffer */
rt_memset(&opt, 0, sizeof(opt));
opt.fmt = FM_ANY|FM_SFD;
#ifdef RT_DFS_ELM_NFATS
opt.n_fat = RT_DFS_ELM_NFATS;
#endif
#ifdef RT_DFS_ELM_CLUSTER_SIZE
opt.au_size = RT_DFS_ELM_CLUSTER_SIZE;
#endif
result = f_mkfs(logic_nbr, &opt, work, FF_MAX_SS);
rt_free(work); work = RT_NULL;

Expand Down
6 changes: 6 additions & 0 deletions components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@ int dfs_elm_mkfs(rt_device_t dev_id, const char *fs_name)
/* [IN] Size of working buffer */
rt_memset(&opt, 0, sizeof(opt));
opt.fmt = FM_ANY|FM_SFD;
#ifdef RT_DFS_ELM_NFATS
opt.n_fat = RT_DFS_ELM_NFATS;
#endif
#ifdef RT_DFS_ELM_CLUSTER_SIZE
opt.au_size = RT_DFS_ELM_CLUSTER_SIZE;
#endif
result = f_mkfs(logic_nbr, &opt, work, FF_MAX_SS);
rt_free(work); work = RT_NULL;

Expand Down
Loading