-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
settings: NVS back-end #12160
Comments
@nvlsianpu, implementing a nvs backend for the settings module is not straight forward. It is mainly limited by the fact that settings supposes that data is stored in the backend as a line consisting of "name"=value. This is of course not good for flash usage as each name is stored in flash again when only the value is changing.
In the set routine value_ctx.len and value_ctx.read(&data, len, arg) can be used and arg contains information that is needed by the backend. |
Generally the idea sound good. b - this mean that you want to move comparation rutine to backends? |
Preparation to fix zephyrproject-rtos#12160 - settings NVS backend To allow easier integration of backends the settings module has been reworked. Major changes are: 1. Change to the api: the set() routines are now of the form: ''set(int argc, char **argv, size_t len, read_cb read, void *cb_arg)'' the length that was found in the backend in len, and the data can be read using: ''read(data, len, cb_arg); 2. The reading of data in the set routines is directly reading in the backend. 3. The records no longer need to be in the line format 4. The runtime interface has been removed (temporarily). A runtime backend will be added. 5. Only the fcb backend is supported at the moment 6. A sample is added under samples/subsys/nsettings Signed-off-by: Laczen JMS <laczenjms@gmail.com>
Preparation to fix zephyrproject-rtos#12160 - settings NVS backend To allow easier integration of backends the settings module has been reworked. Major changes are: 1. Change to the api: the set() routines are now of the form: ''set(int argc, char **argv, size_t len, read_cb read, void *cb_arg)'' the length that was found in the backend in len, and the data can be read using: ''read(data, len, cb_arg); 2. The reading of data in the set routines is directly reading in the backend. 3. The records no longer need to be in the line format 4. The runtime interface has been removed (temporarily). A runtime backend will be added. 5. Only the fcb backend is supported at the moment 6. A sample is added under samples/subsys/nsettings More rework, changes: 1. Runtime "backend" added 2. Reworked configuration of the module. It now allows the selection of a default backend (only FCB at the moment). This sets up the settings src and dst to use the default backend. Other sources could be added by the application. These sources could also be of different type. The module can also be configured without a backend, in this case the application needs to set up the sources and destinations itself. Signed-off-by: Laczen JMS <laczenjms@gmail.com>
Preparation to fix zephyrproject-rtos#12160 - settings NVS backend To allow easier integration of backends the settings module has been reworked. Major changes are: 1. Change to the api: the set() routines are now of the form: ''set(int argc, char **argv, size_t len, read_cb read, void *cb_arg)'' the length that was found in the backend in len, and the data can be read using: ''read(data, len, cb_arg); 2. The reading of data in the set routines is directly reading in the backend. 3. The records no longer need to be in the line format 4. The runtime interface has been removed (temporarily). A runtime backend will be added. 5. Only the fcb backend is supported at the moment 6. A sample is added under samples/subsys/nsettings More rework, changes: 1. Runtime "backend" added 2. Reworked configuration of the module. It now allows the selection of a default backend (only FCB at the moment). This sets up the settings src and dst to use the default backend. Other sources could be added by the application. These sources could also be of different type. The module can also be configured without a backend, in this case the application needs to set up the sources and destinations itself. More rework, changes: 1. NVS backend added 2. Reworked fcb backend, when loading data from storage only the last record is used to call set(), deleted records are not calling set(). More rework, changes: 1. File backend added 2. fcb backend: modification to continue set if no set routine was found for a entry. More rework, changes: 1. File backend modified to allow easier support for settings with multiple configuration sources and destinations. Filenames for the file backend are extended with 0 or 1, the settings system toggles between these two files. Signed-off-by: Laczen JMS <laczenjms@gmail.com>
I will no longer work on trying to add a nvs backend for the settings subsystem, so for me this can be closed. |
This is the early bird of NVS backed By @kapi-no : https://github.com/kapi-no/zephyr/commits/settings_nvs_backend |
NVS was designed as ultra simple FS which is supposed to store configuration values very effectively.
It will be nice to have back-end for it - it can be used instead of fcb back-end. I expect similar complexity, but much better performance as NVS is traversable in both direction and It is able to take care about entry overriding by the implementation.
The text was updated successfully, but these errors were encountered: