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_NVS
56	bool "NVS non-volatile storage support"
57	depends on NVS
58	depends on FLASH_MAP
59	help
60	  Enables NVS storage support
61
62if SETTINGS_NVS
63
64config SETTINGS_NVS_NAME_CACHE
65	bool "NVS name lookup cache"
66	help
67	  Enable NVS name lookup cache, used to reduce the Settings name
68	  lookup time.
69
70config SETTINGS_NVS_NAME_CACHE_SIZE
71	int "NVS name lookup cache size"
72	default 128
73	range 1 $(UINT16_MAX)
74	depends on SETTINGS_NVS_NAME_CACHE
75	help
76	  Number of entries in Settings NVS name cache.
77
78endif # SETTINGS_NVS
79
80config SETTINGS_CUSTOM
81	bool "CUSTOM"
82	help
83	  Use a custom settings storage back-end.
84
85config SETTINGS_NONE
86	bool "NONE"
87	help
88	  No storage back-end.
89endchoice
90
91config SETTINGS_FCB_NUM_AREAS
92	int "Number of flash areas used by the settings subsystem"
93	default 8
94	depends on SETTINGS_FCB
95	help
96	  Number of areas to allocate in the settings FCB. A smaller number is
97	  used if the flash hardware cannot support this value.
98
99config SETTINGS_FCB_MAGIC
100	hex "FCB magic for the settings subsystem"
101	default 0xc0ffeeee
102	depends on SETTINGS_FCB
103	help
104	  Magic 32-bit word for to identify valid settings area
105
106config SETTINGS_FILE_PATH
107	string "Default settings file"
108	default "/settings/run"
109	depends on SETTINGS_FILE
110	help
111	  Full path to the default settings file.
112
113config SETTINGS_FILE_MAX_LINES
114	int "Compression threshold"
115	default 32
116	depends on SETTINGS_FILE
117	help
118	  Limit how many items stored in a file before compressing
119
120config SETTINGS_NVS_SECTOR_SIZE_MULT
121	int "Sector size of the NVS settings area"
122	default 1
123	depends on SETTINGS_NVS
124	help
125	  The sector size to use for the NVS settings area as a multiple of
126	  FLASH_ERASE_BLOCK_SIZE.
127
128config SETTINGS_NVS_SECTOR_COUNT
129	int "Sector count of the NVS settings area"
130	default 8
131	depends on SETTINGS_NVS
132	help
133	  Number of sectors used for the NVS settings area
134
135config SETTINGS_SHELL
136	bool "Settings shell"
137	depends on SHELL
138	help
139	  Enable shell commands for listing and reading the settings. Note that
140	  reading the settings requires quite a big stack buffer, so the stack
141	  size of the shell thread may need to be increased to accommodate this
142	  feature.
143
144endif # SETTINGS
145