|
ZephyrDB
Embedded database for Zephyr RTOS: KV, time-series, and document models
|
ZephyrDB supports multiple backend/storage combinations, so test coverage depends on board capabilities.
The automated test suite lives in tests/; run it with Twister (twister -T tests -p native_sim). This guide covers manual, board-level validation of samples and applications.
Use the board based on what you want to validate.
| Goal | Recommended Board | Notes |
|---|---|---|
| Automated behavioral tests | native_sim | Runs the full KV/TS/DOC suite against the flash simulator and LittleFS |
| Backend behavior on real flash | nrf52840dk | Validates NVS/ZMS/FCB/LittleFS wear, timing, and persistence on hardware |
| Final application validation | Production hardware | Validates board-specific runtime behavior |
| Capability | native_sim | nrf52840dk |
|---|---|---|
| Build and link validation | Yes | Yes |
| NVS backend runtime behavior | Yes (flash simulator) | Yes |
| ZMS backend runtime behavior | Yes (flash simulator) | Yes |
| FCB backend runtime behavior | Limited | Yes |
| LittleFS-backed TS or DOC validation | Yes (flash simulator) | Yes |
| SD card overlays | No | Yes |
| Power-loss / reboot persistence | Approximated (deinit/init cycle) | Yes (manual two-run check) |
| Bounded (rolling) streams | Yes | Yes |
| Concurrent time-series streams | Yes | Yes |
| FlatBuffers export | Needs flatcc-zephyr in the workspace | Needs flatcc-zephyr in the workspace |
native_sim runs the storage backends against the flash simulator, which exercises real backend code paths but not flash wear, timing, or power-loss behavior — validate those on hardware. A zdb_deinit()/zdb_init() cycle against a mounted backend stands in for a restart in the suites, which covers index and segment rebuilding but not an interrupted write. native_sim itself only builds on Linux hosts.
Run a loop over all samples:
Use native_sim for fastest feedback.
Use a flash-capable board and backend overlay (for example, prj_nrf52840dk.conf or prj_zms.conf).
Use nrf52840dk with a storage backend configured in the sample overlay.
Use a filesystem-capable target and ensure flatcc-zephyr is present in workspace.
When using Zephyr Settings and ZephyrDB together, allocate dedicated partitions for:
This prevents backend overlap and cross-subsystem data conflicts.
Switch to a flash-capable board or adjust backend options in your overlay.
Re-test on a flash-capable board with proper storage configuration.
Check backend capability. Some TS operations are backend-specific (for example, aggregate query behavior).
Verify the serial device and baud rate: