How to apply key values to store databases in embedded products

Source: Internet
Author: User
Tags value store

"Disclaimer: Copyright, welcome reprint, please do not use for commercial purposes. Contact mailbox: [Email protected] "

1. Background

With the rapid development of Internet and the advent of the era of big data, NoSQL database has been developed with its strong scalability, high efficiency and real-time characteristics. Key value (key-value) Storage database is a NoSQL one, the famous Redis is a C development of open-source key value pair storage database.

At the same time, more and more manufacturers to join the IoT products, wearable devices, smart home embedded product development ranks, the data of persistent storage needs have become more and more, selection of a good scalability, small footprint, high stability, and can be applied to embedded products, the persistence of storage is becoming more and more important.

2, Easyflash

Easyflash is an open source lightweight embedded flash memory library that provides a convenient, general-purpose upper-level application interface for MCUs, offering 3 main functions: ENV (environment variable), IAP (online upgrade), and log (Flash storage log). This article mainly describes the ENV function that makes flash a small key-value store database.

3, increase and revise the search

To invoke the common interface of environment variables through the console (terminal), the process of environment variable "temp" from creation to save, then modify, and finally delete is demonstrated. These interfaces are supported for direct invocation by the application layer.

Easyflash environment variable function API is located in the https://github.com/armink/easyflash/blob/master/docs/zh/api.md#12-environment variable
The main use methods are as follows:

/* 创建Key名为temp的环境变量,并赋初值"123" */ef_set_env("temp","123");/* 修改环境变量temp的值为"456" */ef_set_env("temp","456");/* 读取环境变量temp的值 */char *temp = ef_get_env("temp");/* 删除环境变量temp */ef_set_env("temp","");
4. Usage Scenarios

At present, the author has applied Easyflash products, mainly store the following content

    • 1, the operating parameters of the power of the product;
    • 2, Operation Record;
    • 3, the user can edit the parameters;
    • 4, software assertions and hardware anomalies, such as system crash log;
    • 5. The interactive parameters between Bootloader and app during online upgrade;
    • 6, more storage content to be dug ...
5. Demo

The ported hardware platform now has stm32f10x and STM32F4XX series on-chip flash and supports bare-metal and rt-thread embedded operating systems. Welcome to starand pull request and provide more platform support and advice.

How to apply key values to store databases in embedded products

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.