Take you to try the LiteOS component EasyFlash

Absrtact: EasyFlash is an open source lightweight embedded flash library.

This article is shared from Huawei cloud community< A taste of LiteOS components - play with EasyFlash >, by Lionlace.

Basic introduction

EasyFlash is an open source lightweight embedded Flash memory library. It occupies low resources and provides a convenient application interface for MCU (micro control unit), which makes it easier and faster for developers to realize application development based on Flash memory. It can be widely used in smart home, wearable, industrial control, medical treatment, Internet of things and other product fields that need power-off storage function.

At present, the library mainly provides the following functions:

  • Env (environment variable) quickly saves product parameters;
  • Support write balance mode (wear balance) and power down protection.

Easyflash can not only store setting parameters and operation logs, provide power down protection, but also encapsulate the methods of addition, deletion, modification and query to help developers deal with product parameters more easily. Easyflash can also turn Flash into a small key value storage database of NoSQL (non relational database) model.

instructions

Enable EasyFlash Demo

Compiling environment and cloud with Linux system_ STM32F429IGTx_ Take fire development board as an example and copy cloud_ STM32F429IGTx_ Default configuration file ${platform} for fire development board Config to the root directory of the LiteOS project and rename it to config.

cp tools/build/config/Cloud_STM32F429IGTx_FIRE.config .config

Execute the make menuconfig command in the root directory of the LiteOS project, and check the following related configurations to enable.

EasyFlash Demo: 
   Demos  --->
        Utility Demo  --->
               [*] Enable EasyFlash Demo

When EasyFlash Demo is checked, the EasyFlash components it depends on will be enabled automatically. After saving and exiting menuconfig, automatically execute components / download SH script.

  • Download EasyFlash-3.3.0 from the Internet 0 source code.
  • Liteos from gitee_ The components component warehouse downloads the corresponding patch package and enters the patch into the source code.

For the detailed process of Component download, please refer to: LiteOS_Components: Huawei LiteOS component warehouse, which mainly stores component patches and related verification files.

Note: when downloading components, Linux environment can access the Internet and git tool has been installed.

Compile and run EasyFlash Demo

Execute the following command under the root directory of LiteOS project to compile:

make clean ; make -j

After compilation, in out / Cloud_ STM32F429IGTx_ Generate libeasyflash.exe in fire / lib directory A and libef_demo.a. The system image file is out/Cloud_STM32F429IGTx_FIRE/Huawei_LiteOS.bin.

Burn system image files to cloud_ STM32F429IGTx_ On the fire development board, you can see the serial port output Demo running result log after power on and reset, as shown below.

********Hello Huawei LiteOS********
LiteOS Kernel Version : 5.1.0
build date : Nov 22 2021 17:13:30
**********************************
OsAppInit
cpu 0 entering scheduler
app init!
Hello, welcome to liteos demo!
[SFUD]Find a Winbond W25Q256JV flash chip. Size is 33554432 bytes.
[SFUD]W25Q256JV flash device is initialized successfully.
[Flash]EasyFlash V3.3.0 is initialized successfully.
[Flash]You can get the latest version on https://github.com/armink/EasyFlash .
Huawei LiteOS # Ready to write Event.
Save env, "TickCount"=2007
Ready to write Event.
Save env, "TickCount"=4007
Ready to write Event.
Save env, "TickCount"=6007
Ready to write Event.
Save env, "TickCount"=8007
Get Env, TickCount=8007
Swtmr delete.
Mutex delete.
Event destroy.
Easyflash task delete.

Click focus to learn about Huawei cloud's new technologies for the first time~

Keywords: Flash liteos

Added by cocpg on Thu, 16 Dec 2021 05:30:22 +0200