Commit Graph

7 Commits

Author SHA1 Message Date
Ulf Magnusson aa26289458 kconfig: Get rid of leading/trailing whitespace in prompts
Leading/trailing whitespace in prompts requires ugly workarounds in
genrest.py, as e.g. *prompt * is invalid RST. strip() all prompts in
Kconfiglib and get rid of the genrest.py workarounds. Add a warning too.

The Kconfiglib update has some unrelated cleanups and fixes (that won't
affect Zephyr).

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-19 09:26:39 +03:00
Johan Hedberg 72050f46bc settings: Make it safe to call settings_subsys_init() multiple times
The settings_init() API was protected against multiple calls, but the
only function that calls it, settings_subsys_init(), was not. Add the
protection to the higher-level function as well.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-17 12:17:30 +02:00
Andrzej Puzdrowski cf06bc58a7 susbsys: settings: optimized fcb compression for deleted entry
During the compression an empty settings entry was
copied to the scratch sector form the oldest sector in case
lack of newer entry version in fcb storage.

This doesn't make sense as empty entry and lack of entry has
similar meaning.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-05-11 09:56:52 +02:00
Johan Hedberg d67009da08 subsys: settings: Fix Kconfig dependencies
If CONFIG_FLASH_PAGE_LAYOUT is not enabled, building the settings code
fails at the linking stage with the following error when FCB is the
backend.

libzephyr.a(settings_init.c.obj): In function `settings_init_fcb':
subsys/settings/src/settings_init.c:62: undefined reference to `flash_area_get_sectors'
collect2: error: ld returned 1 exit status

Also, the File System backend will currently only work with NFFS due
to fs_rename() missing from other File Systems (FAT in particular).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-04-26 16:24:31 +02:00
Andrzej Puzdrowski 341b427366 subsys: settings: fix fcb back-end initialization
In f. settings_init_fcb the storage area was implemented badly:
- storage was always erased
- the only source of settings fcb instance was pointed twice.
This patch fix both issues.


Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-04-25 22:25:32 +05:30
Andrzej Puzdrowski 9fe30535d7 susbsys: settings: fix coverity issues
API settings_subsys_init call was changed so that it returns
error (so returns int instead of void).
Prototype of storage helper function export_func for
settings_handler::h_export was changed so that it returns error
(so returns int instead of void).
Fixed few other error handling issues by ignoring return
values.

Tests were aligned to above patches.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-04-25 22:25:32 +05:30
Andrzej Puzdrowski 94ff339cbf subsys: Add a new settings subsystem
Adapt the MyNewt non-volatile configuration system to become a settings
system in Zephyr.
The original code was modifed in the following ways:

* Renamed from config to settings
* Use the zephyr FCB, FS API, and base64 subsystems
* lltoa like function was added to sources as it was required but not
  included in Zephyr itself.
* The original code was modified to use Zephyr's slist.h as single
  linked list implementation.
* Reworked code which was using strtok_r, added function
  for decoding a string to a s64_t value.
* Thank to the above the settings subsys doesn't require newlibc anymore.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-28 10:44:20 -04:00