zephyr/subsys/settings/Kconfig
Marcin Niestroj 2d3365200c settings: file: drop CONFIG_SETTINGS_FILE_DIR
There is already CONFIG_SETTINGS_FILE_PATH, which is set to full file path,
while CONFIG_SETTINGS_FILE_DIR is required to be set to its parent
directory. This is redundant, as parent directory path can be easily found
out either during runtime or optionally during buildtime by CMake.

CONFIG_SETTINGS_FILE_DIR was actually introduced recently after Zephyr 3.2
release as a replacement of deprecated CONFIG_SETTINGS_FS_DIR. This means,
that there is no need to deprecate it for 3.3 release and dropping it
should be fine. Adjust 3.3 release notes accordingly, so that
CONFIG_SETTINGS_FILE_PATH will be used directly.

This patch stops using deprecated CONFIG_SETTINGS_FS_DIR. There is actually
no value in respecting it, as setting anything other than parent directory
of CONFIG_SETTINGS_FS_FILE makes no sense.

There is actually one use of CONFIG_SETTINGS_FILE_DIR in file backend
tests, to derive directory for files containing tested settings.
CONFIG_SETTINGS_FILE_PATH is not used there, so it makes little sense to
derive directory name from it. Instead, just use hardcoded "/settings"
subdirectory, as this was the default value of CONFIG_SETTINGS_FILE_DIR.

Deriving parent directory can be done either in runtime or in
buildtime (e.g. using some helper CMake function). Doing it in runtime
however allows to create directory recursively (which this patch actually
implements), e.g. for some more nested FS tree structure. Additionally it
will simplify migration of settings configuration from Kconfig to
device-tree (yet to be developed feature).

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-14 14:11:03 +01:00

174 lines
4.1 KiB
Plaintext

# Copyright (c) 2018 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
menuconfig SETTINGS
bool "Settings"
help
The settings subsystem allows its users to serialize and
deserialize state in memory into and from non-volatile memory.
It supports several back-ends to store and load serialized data from
and it can do so atomically for all involved modules.
if SETTINGS
module = SETTINGS
module-str = settings
source "subsys/logging/Kconfig.template.log_config"
config SETTINGS_RUNTIME
bool "runtime storage back-end"
help
Enables runtime storage back-end.
config SETTINGS_DYNAMIC_HANDLERS
bool "dynamic settings handlers"
default y
help
Enables the use of dynamic settings handlers
# Hidden option to enable encoding length into settings entry
config SETTINGS_ENCODE_LEN
bool
choice SETTINGS_BACKEND
prompt "Storage back-end"
default SETTINGS_NVS if NVS
default SETTINGS_FCB if FCB
default SETTINGS_FILE if FILE_SYSTEM
default SETTINGS_NONE
help
Storage back-end to be used by the settings subsystem.
config SETTINGS_FCB
bool "FCB"
depends on FCB
help
Use FCB as a settings storage back-end.
config SETTINGS_FILE
bool "File"
depends on FILE_SYSTEM
select SETTINGS_ENCODE_LEN
help
Use a file (on mounted file system) as a settings storage back-end.
config SETTINGS_FS
bool "FS (DEPRECATED)"
depends on FILE_SYSTEM
select SETTINGS_ENCODE_LEN
select DEPRECATED
help
This is deprecated, please use SETTINGS_FILE instead.
config SETTINGS_NVS
bool "NVS non-volatile storage support"
depends on NVS
depends on FLASH_MAP
help
Enables NVS storage support
if SETTINGS_NVS
config SETTINGS_NVS_NAME_CACHE
bool "NVS name lookup cache"
help
Enable NVS name lookup cache, used to reduce the Settings name
lookup time.
config SETTINGS_NVS_NAME_CACHE_SIZE
int "NVS name lookup cache size"
default 128
range 1 65535
depends on SETTINGS_NVS_NAME_CACHE
help
Number of entries in Settings NVS name cache.
endif # SETTINGS_NVS
config SETTINGS_CUSTOM
bool "CUSTOM"
help
Use a custom settings storage back-end.
config SETTINGS_NONE
bool "NONE"
help
No storage back-end.
endchoice
config SETTINGS_FCB_NUM_AREAS
int "Number of flash areas used by the settings subsystem"
default 8
depends on SETTINGS_FCB
help
Number of areas to allocate in the settings FCB. A smaller number is
used if the flash hardware cannot support this value.
config SETTINGS_FCB_MAGIC
hex "FCB magic for the settings subsystem"
default 0xc0ffeeee
depends on SETTINGS_FCB
help
Magic 32-bit word for to identify valid settings area
config SETTINGS_FILE_PATH
string "Default settings file"
default "/settings/run"
depends on SETTINGS_FILE
help
Full path to the default settings file.
config SETTINGS_FILE_MAX_LINES
int "Compression threshold"
default 32
depends on SETTINGS_FILE
help
Limit how many items stored in a file before compressing
config SETTINGS_FS_DIR
string "Serialization directory (DEPRECATED)"
default "/settings"
depends on SETTINGS_FS
help
This is deprecated. Use SETTINGS_FILE_PATH instead.
config SETTINGS_FS_FILE
string "Default settings file (DEPRECATED)"
default "/settings/run"
depends on SETTINGS_FS
help
This is deprecated. Use SETTINGS_FILE_PATH instead.
config SETTINGS_FS_MAX_LINES
int "Compression threshold (DEPRECATED)"
default 32
depends on SETTINGS_FS
help
This is deprecated. Use SETTINGS_FILE_MAX_LINES instead.
config SETTINGS_NVS_SECTOR_SIZE_MULT
int "Sector size of the NVS settings area"
default 1
depends on SETTINGS_NVS
help
The sector size to use for the NVS settings area as a multiple of
FLASH_ERASE_BLOCK_SIZE.
config SETTINGS_NVS_SECTOR_COUNT
int "Sector count of the NVS settings area"
default 8
depends on SETTINGS_NVS
help
Number of sectors used for the NVS settings area
config SETTINGS_SHELL
bool "Settings shell"
depends on SHELL
help
Enable shell commands for listing and reading the settings. Note that
reading the settings requires quite a big stack buffer, so the stack
size of the shell thread may need to be increased to accommodate this
feature.
endif # SETTINGS