1# Copyright (c) 2018 Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4menuconfig SETTINGS
5	bool "Settings"
6	help
7	  The settings subsystem allows its users to serialize and
8	  deserialize state in memory into and from non-volatile memory.
9	  It supports several back-ends to store and load serialized data from
10	  and it can do so atomically for all involved modules.
11
12if SETTINGS
13
14module = SETTINGS
15module-str = settings
16source "subsys/logging/Kconfig.template.log_config"
17
18config SETTINGS_RUNTIME
19	bool "runtime storage back-end"
20	help
21	  Enables runtime storage back-end.
22
23config SETTINGS_DYNAMIC_HANDLERS
24	bool "dynamic settings handlers"
25	default y
26	help
27	  Enables the use of dynamic settings handlers
28
29# Hidden option to enable encoding length into settings entry
30config SETTINGS_ENCODE_LEN
31	bool
32
33choice SETTINGS_BACKEND
34	prompt "Storage back-end"
35	default SETTINGS_NVS if NVS
36	default SETTINGS_FCB if FCB
37	default SETTINGS_FILE if FILE_SYSTEM
38	default SETTINGS_NONE
39	help
40	  Storage back-end to be used by the settings subsystem.
41
42config SETTINGS_FCB
43	bool "FCB"
44	depends on FCB
45	help
46	  Use FCB as a settings storage back-end.
47
48config SETTINGS_FILE
49	bool "File"
50	depends on FILE_SYSTEM
51	select SETTINGS_ENCODE_LEN
52	help
53	  Use a file (on mounted file system) as a settings storage back-end.
54
55config SETTINGS_FS
56	bool "FS (DEPRECATED)"
57	depends on FILE_SYSTEM
58	select SETTINGS_ENCODE_LEN
59	select DEPRECATED
60	help
61	  This is deprecated, please use SETTINGS_FILE instead.
62
63config SETTINGS_NVS
64	bool "NVS non-volatile storage support"
65	depends on NVS
66	depends on FLASH_MAP
67	help
68	  Enables NVS storage support
69
70if SETTINGS_NVS
71
72config SETTINGS_NVS_NAME_CACHE
73	bool "NVS name lookup cache"
74	help
75	  Enable NVS name lookup cache, used to reduce the Settings name
76	  lookup time.
77
78config SETTINGS_NVS_NAME_CACHE_SIZE
79	int "NVS name lookup cache size"
80	default 128
81	range 1 65535
82	depends on SETTINGS_NVS_NAME_CACHE
83	help
84	  Number of entries in Settings NVS name cache.
85
86endif # SETTINGS_NVS
87
88config SETTINGS_CUSTOM
89	bool "CUSTOM"
90	help
91	  Use a custom settings storage back-end.
92
93config SETTINGS_NONE
94	bool "NONE"
95	help
96	  No storage back-end.
97endchoice
98
99config SETTINGS_FCB_NUM_AREAS
100	int "Number of flash areas used by the settings subsystem"
101	default 8
102	depends on SETTINGS_FCB
103	help
104	  Number of areas to allocate in the settings FCB. A smaller number is
105	  used if the flash hardware cannot support this value.
106
107config SETTINGS_FCB_MAGIC
108	hex "FCB magic for the settings subsystem"
109	default 0xc0ffeeee
110	depends on SETTINGS_FCB
111	help
112	  Magic 32-bit word for to identify valid settings area
113
114config SETTINGS_FILE_PATH
115	string "Default settings file"
116	default "/settings/run"
117	depends on SETTINGS_FILE
118	help
119	  Full path to the default settings file.
120
121config SETTINGS_FILE_MAX_LINES
122	int "Compression threshold"
123	default 32
124	depends on SETTINGS_FILE
125	help
126	  Limit how many items stored in a file before compressing
127
128config SETTINGS_FS_DIR
129	string "Serialization directory (DEPRECATED)"
130	default "/settings"
131	depends on SETTINGS_FS
132	help
133	  This is deprecated. Use SETTINGS_FILE_PATH instead.
134
135config SETTINGS_FS_FILE
136	string "Default settings file (DEPRECATED)"
137	default "/settings/run"
138	depends on SETTINGS_FS
139	help
140	  This is deprecated. Use SETTINGS_FILE_PATH instead.
141
142config SETTINGS_FS_MAX_LINES
143	int "Compression threshold (DEPRECATED)"
144	default 32
145	depends on SETTINGS_FS
146	help
147	  This is deprecated. Use SETTINGS_FILE_MAX_LINES instead.
148
149config SETTINGS_NVS_SECTOR_SIZE_MULT
150	int "Sector size of the NVS settings area"
151	default 1
152	depends on SETTINGS_NVS
153	help
154	  The sector size to use for the NVS settings area as a multiple of
155	  FLASH_ERASE_BLOCK_SIZE.
156
157config SETTINGS_NVS_SECTOR_COUNT
158	int "Sector count of the NVS settings area"
159	default 8
160	depends on SETTINGS_NVS
161	help
162	  Number of sectors used for the NVS settings area
163
164config SETTINGS_SHELL
165	bool "Settings shell"
166	depends on SHELL
167	help
168	  Enable shell commands for listing and reading the settings. Note that
169	  reading the settings requires quite a big stack buffer, so the stack
170	  size of the shell thread may need to be increased to accommodate this
171	  feature.
172
173endif # SETTINGS
174