1# Copyright (c) 2019 Bolt Innovation Management, LLC
2# Copyright (c) 2019 Peter Bigot Consulting, LLC
3# Copyright (c) 2020 Nordic Semiconductor ASA
4# SPDX-License-Identifier: Apache-2.0
5
6config FILE_SYSTEM_LITTLEFS
7	bool "LittleFS support"
8	depends on FILE_SYSTEM
9	depends on ZEPHYR_LITTLEFS_MODULE
10	help
11	  Enables LittleFS file system support.
12
13if FILE_SYSTEM_LITTLEFS
14
15menu "LittleFS Settings"
16	visible if FILE_SYSTEM_LITTLEFS
17
18config FS_LITTLEFS_NUM_FILES
19	int "Maximum number of opened files"
20	default 4
21	help
22	  This is a global maximum across all mounted littlefs filesystems.
23
24config FS_LITTLEFS_NUM_DIRS
25	int "Maximum number of opened directories"
26	default 4
27	help
28	  This is a global maximum across all mounted littlefs filesystems.
29
30config FS_LITTLEFS_READ_SIZE
31	int "Minimum size of a block read"
32	default 16
33	help
34	  All read operations will be a multiple of this value.
35
36config FS_LITTLEFS_PROG_SIZE
37	int "Minimum size of a block program"
38	default 16
39	help
40	  All program operations will be a multiple of this value.
41
42config FS_LITTLEFS_CACHE_SIZE
43	int "Size of block caches in bytes"
44	default 64
45	help
46	  Each cache buffers a portion of a block in RAM.  The littlefs
47	  needs a read cache, a program cache, and one additional cache
48	  per file. Larger caches can improve performance by storing
49	  more data and reducing the number of disk accesses. Must be a
50	  multiple of the read and program sizes of the underlying flash
51	  device, and a factor of the block size.
52
53config FS_LITTLEFS_LOOKAHEAD_SIZE
54	int "Size of lookahead buffer in bytes"
55	default 32
56	help
57	  A larger lookahead buffer increases the number of blocks found
58	  during an allocation pass. The lookahead buffer is stored as a
59	  compact bitmap, so each byte of RAM can track 8 blocks. Must
60	  be a multiple of 8.
61
62config FS_LITTLEFS_BLOCK_CYCLES
63	int "Number of erase cycles before moving data to another block"
64	default 512
65	help
66	  For dynamic wear leveling, the number of erase cycles before data
67	  is moved to another block.  Set to a non-positive value to
68	  disable leveling.
69
70endmenu
71
72config FS_LITTLEFS_FC_HEAP_SIZE
73	int "Enable flexible file cache sizes for littlefs"
74	default 0
75	help
76	  littlefs requires a per-file buffer to cache data.
77
78	  When applications customize littlefs configurations and support
79	  different cache sizes for different partitions this preallocation is
80	  inadequate as an application might require a small number of files
81	  using a large cache size and a larger number of files using a
82	  smaller cache size.  In that case application should provide a
83	  positive value for the heap size.  Be aware that there is a
84	  per-allocation overhead that affects how much usable space is
85	  present in the heap.
86
87	  If this option is set to a non-positive value the heap is sized to
88	  support up to FS_LITTLE_FS_NUM_FILES blocks of
89	  FS_LITTLEFS_CACHE_SIZE bytes.
90
91if FS_LITTLEFS_FC_HEAP_SIZE <= 0
92
93config FS_LITTLEFS_HEAP_PER_ALLOC_OVERHEAD_SIZE
94	int "Size of per-allocation overhead for littleFS heap in bytes"
95	default 32
96	help
97	  In case when total size of littleFS heap is automatically calculated
98	  we need to take into account overhead caused per block allocation.
99	  For the purpose of heap size calculation the size of each cache block
100	  will be increased by this value.
101	  NOTE: when your app fails to open pre-defined number of files, as set
102	  by FS_LITTLEFS_NUM_FILES, try to increase the value.
103
104endif # FS_LITTLEFS_FC_HEAP_SIZE <= 0
105
106config FS_LITTLEFS_FMP_DEV
107	bool "Support for littlefs on flash devices"
108	depends on FLASH_MAP
109	depends on FLASH_PAGE_LAYOUT || !FLASH_HAS_EXPLICIT_ERASE
110	default y
111	help
112	  Enable this option to provide support for littlefs on flash devices
113	  (using the flash_map API).
114
115config FS_LITTLEFS_BLK_DEV
116	bool "Support for littlefs on block devices"
117	help
118	  Enable this option to provide support for littlefs on the block
119	  devices (like for example SD card).
120
121endif # FILE_SYSTEM_LITTLEFS
122