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
13module = SETTINGS
14module-str = settings
15source "subsys/logging/Kconfig.template.log_config"
16endif
17
18config SETTINGS_RUNTIME
19	bool "runtime storage back-end"
20	depends on SETTINGS
21	help
22	  Enables runtime storage back-end.
23
24config SETTINGS_DYNAMIC_HANDLERS
25	bool "dynamic settings handlers"
26	depends on SETTINGS
27	default y
28	help
29	  Enables the use of dynamic settings handlers
30
31# Hidden option to enable encoding length into settings entry
32config SETTINGS_ENCODE_LEN
33	depends on SETTINGS
34	bool
35
36choice
37	prompt "Storage back-end"
38	default SETTINGS_NVS if NVS
39	default SETTINGS_FCB if FCB
40	default SETTINGS_FS if FILE_SYSTEM
41	default SETTINGS_NONE
42	depends on SETTINGS
43	help
44	  Storage back-end to be used by the settings subsystem.
45
46config SETTINGS_FCB
47	bool "FCB"
48	depends on FCB
49	help
50	  Use FCB as a settings storage back-end.
51
52config SETTINGS_FS
53	bool "File System"
54	depends on FILE_SYSTEM
55	select SETTINGS_ENCODE_LEN
56	help
57	  Use a file system as a settings storage back-end.
58
59config SETTINGS_NVS
60	bool "NVS non-volatile storage support"
61	depends on NVS
62	depends on FLASH_MAP
63	help
64	  Enables NVS storage support
65
66config SETTINGS_CUSTOM
67	bool "CUSTOM"
68	help
69	  Use a custom settings storage back-end.
70
71config SETTINGS_NONE
72	bool "NONE"
73	help
74	  No storage back-end.
75endchoice
76
77config SETTINGS_FCB_NUM_AREAS
78	int "Number of flash areas used by the settings subsystem"
79	default 8
80	depends on SETTINGS && SETTINGS_FCB
81	help
82	  Number of areas to allocate in the settings FCB. A smaller number is
83	  used if the flash hardware cannot support this value.
84
85config SETTINGS_FCB_MAGIC
86	hex "FCB magic for the settings subsystem"
87	default 0xc0ffeeee
88	depends on SETTINGS && SETTINGS_FCB
89	help
90	  Magic 32-bit word for to identify valid settings area
91
92config SETTINGS_FS_DIR
93	string "Serialization directory"
94	default "/settings"
95	depends on SETTINGS && SETTINGS_FS
96	help
97	  Directory where the settings data is stored
98
99config SETTINGS_FS_FILE
100	string "Default settings file"
101	default "/settings/run"
102	depends on SETTINGS && SETTINGS_FS
103	help
104	  Full path to the default settings file.
105
106config SETTINGS_FS_MAX_LINES
107	int "Compression threshold"
108	default 32
109	depends on SETTINGS && SETTINGS_FS
110	help
111	  Limit how many items stored in a file before compressing
112
113config SETTINGS_NVS_SECTOR_SIZE_MULT
114	int "Sector size of the NVS settings area"
115	default 1
116	depends on SETTINGS && SETTINGS_NVS
117	help
118	  The sector size to use for the NVS settings area as a multiple of
119	  FLASH_ERASE_BLOCK_SIZE.
120
121config SETTINGS_NVS_SECTOR_COUNT
122	int "Sector count of the NVS settings area"
123	default 8
124	depends on SETTINGS && SETTINGS_NVS
125	help
126	  Number of sectors used for the NVS settings area
127