1. EasyFlash

Easyflash可以让 Flash 成为小型 KV 数据库(Key-Value) GitHub: https://github.com/armink/SFUD Gitee: https://gitee.com/Armink/EasyFlash

2. EasyFlash的移植

① 使用keil添加工程并添加对应的头文件

② 编写ef_port.c

/*
* This file is part of the EasyLogger Library.
*
* Copyright (c) 2015, Armink, <armink.ztl@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Function: Portable interface for each platform.
* Created on: 2015-04-28
*/ #include <elog.h>
#include <elog_flash.h>
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h" #include <sfud.h>
#include "BSP_DebugUART.h" static SemaphoreHandle_t xMutexElog= NULL;
/**
* EasyLogger port initialize
*
* @return result
*/
ElogErrCode elog_port_init(void) {
ElogErrCode result = ELOG_NO_ERR; /* add your code here */
xMutexElog = xSemaphoreCreateMutex(); /* 创建互斥信号量 */
if(xMutexElog == NULL)
{
/* 没有创建成功,用户可以在这里加入创建失败的处理机制 */
while(1);
} return result;
} /**
* EasyLogger port deinitialize
*
*/
void elog_port_deinit(void) { /* add your code here */ } /**
* output log port interface
*
* @param log output of log
* @param size log size
*/
void elog_port_output(const char *log, size_t size) { /* add your code here */
// printf("%.*s", size, log);
BSP_Printf("%.*s", size, log);
/* output to flash */
if( isFlashReady )
elog_flash_write(log, size);
} /**
* output lock
*/
void elog_port_output_lock(void) { /* add your code here */
/* 裸机中使用开关中断方法 */
// __disable_irq();
/* add your code here */
/* OS 中使用临界区或互斥量,推荐互斥量方式 */
// taskENTER_CRITICAL(); /* 进入临界区 */
xSemaphoreTake(xMutexElog, portMAX_DELAY); /* 互斥信号量 */
} /**
* output unlock
*/
void elog_port_output_unlock(void) { /* add your code here */
/* 裸机中使用开关中断方法 */
// __enable_irq();
/* add your code here */
/* OS 中使用临界区或互斥量,推荐互斥量方式 */
// taskEXIT_CRITICAL(); /* 退出临界区 */
xSemaphoreGive(xMutexElog); /* 互斥信号量 */ } /**
* get current time interface
*
* @return current time
*/
const char *elog_port_get_time(void) { /* add your code here */
//ydm 这里需要配置RTC相关,暂时写一个固定值
return "10:08:12"; } /**
* get current process name interface
*
* @return current process name
*/
const char *elog_port_get_p_info(void) { /* add your code here */
return "";
} /**
* get current thread name interface
*
* @return current thread name
*/
const char *elog_port_get_t_info(void) { /* add your code here */
return pcTaskGetName(NULL); }

③ 编写ef_cfg.h

/*
* This file is part of the EasyLogger Library.
*
* Copyright (c) 2015-2016, Armink, <armink.ztl@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Function: It is the configure head file for this library.
* Created on: 2015-07-30
*/ #ifndef _ELOG_CFG_H_
#define _ELOG_CFG_H_
/*---------------------------------------------------------------------------*/
/* enable log output. */
#define ELOG_OUTPUT_ENABLE
/* setting static output log level. range: from ELOG_LVL_ASSERT to ELOG_LVL_VERBOSE */
#define ELOG_OUTPUT_LVL ELOG_LVL_VERBOSE
/* enable assert check */
#define ELOG_ASSERT_ENABLE
/* buffer size for every line's log */
#define ELOG_LINE_BUF_SIZE 1024
/* output line number max length */
#define ELOG_LINE_NUM_MAX_LEN 5
/* output filter's tag max length */
#define ELOG_FILTER_TAG_MAX_LEN 30
/* output filter's keyword max length */
#define ELOG_FILTER_KW_MAX_LEN 16
/* output filter's tag level max num */
#define ELOG_FILTER_TAG_LVL_MAX_NUM 5
/* output newline sign */
#define ELOG_NEWLINE_SIGN "\r\n"
/*---------------------------------------------------------------------------*/
/* enable log color */
//#define ELOG_COLOR_ENABLE
/* change the some level logs to not default color if you want */
//#define ELOG_COLOR_ASSERT (F_MAGENTA B_NULL S_NORMAL)
//#define ELOG_COLOR_ERROR (F_RED B_NULL S_NORMAL)
//#define ELOG_COLOR_WARN (F_YELLOW B_NULL S_NORMAL)
//#define ELOG_COLOR_INFO (F_CYAN B_NULL S_NORMAL)
//#define ELOG_COLOR_DEBUG (F_GREEN B_NULL S_NORMAL)
//#define ELOG_COLOR_VERBOSE (F_BLUE B_NULL S_NORMAL)
/*---------------------------------------------------------------------------*/
/* enable asynchronous output mode */
//#define ELOG_ASYNC_OUTPUT_ENABLE
/* the highest output level for async mode, other level will sync output */
//#define ELOG_ASYNC_OUTPUT_LVL ELOG_LVL_ASSERT
/* buffer size for asynchronous output mode */
//#define ELOG_ASYNC_OUTPUT_BUF_SIZE (ELOG_LINE_BUF_SIZE * 10)
/* each asynchronous output's log which must end with newline sign */
//#define ELOG_ASYNC_LINE_OUTPUT
/* asynchronous output mode using POSIX pthread implementation */
//#define ELOG_ASYNC_OUTPUT_USING_PTHREAD
/*---------------------------------------------------------------------------*/
/* enable buffered output mode */
#define ELOG_BUF_OUTPUT_ENABLE
/* buffer size for buffered output mode */
#define ELOG_BUF_OUTPUT_BUF_SIZE (ELOG_LINE_BUF_SIZE * 1) #endif /* _ELOG_CFG_H_ */

3. EasyFlash的使用

查看对应的API文档

FreeRTOS移植EasyFlash的更多相关文章

  1. 基于IAR平台FreeRTOS移植

     开始这篇文章之前先简单说明一下,我使用的MCU是我们公司自主研发的ACH1180芯片,和STM32差不多,都是Cortex-M4的核,所以移植的过程参考了STM32移植的步骤. 1.解压FreeRT ...

  2. nRF52832 SDK15.3.0 基于ble_app_uart demo FreeRTOS移植

    参考资料:https://blog.csdn.net/u010860832/article/details/86235993 这里把移植经验记录下来,供有需要的同学参考,有不对的地方也请大家批评指正. ...

  3. FreeRTOS移植到STM32上的移植过程

    所有的单片机都是顺序执行的,而对于多任务而言就显得力不从心了,虽然在一些小项目中可以通过定时器来实现,但这种实现方式没有实时性,一旦任务需要在规定时间内做出响应,那只能通过实时操作系统来完成了.在很多 ...

  4. FreeRTOS 移植到WIN10

    背景 标题表述的不准确,大意是移植到WIN10的PC机,Intel I5. 最近因为项目接触了FreeRTOS 实时操作系统,想对这个操作系统有一个更深入的了解,所以决定下载源码看看,下面这个链接的随 ...

  5. 1、FreeRTOS移植

    1.FreeRTOS目录结构 FreeRTOS FreeRTOS简略目录如下: ├─FreeRTOS │ ├─Demo // 各种开发工具的完整Demo,开发者可以方便的以此搭建出自己的项目,甚至直接 ...

  6. FreeRtos——移植

    现在准备的简单程序LED灯的工程目录中增加freertos文件夹: 在 source目录下的portable目录下只留下下面的文件夹: 为什么呢? 把对应文件移植在工程中之后,添加头文件路径如下图: ...

  7. 超详细的FreeRTOS移植全教程——基于srm32

    ### 准备 在移植之前,我们首先要获取到FreeRTOS的官方的源码包.这里我们提供两个下载链接: > 一个是官网:http://www.freertos.org/ > 另外一个是代码托 ...

  8. SystemView SEGGER FreeRTOS 移植和使用

    /* 官方帮助英文翻译文档参考:https://blog.csdn.net/bjr2016/article/category/7275877. */ /* 移植文档参考:https://blog.cs ...

  9. FreeRTOS 移植

    添加FreeRTOS源码到工程中 在工程源码中创建FreeRTOS目录存放拷贝的文件 拷贝FreeRTOS->Source中的文件 可将其他不需要的文件夹全部删掉,只留3个 拷贝Demo中Fre ...

随机推荐

  1. 【.NET 与树莓派】六轴飞控传感器(MPU 6050)

    所谓"飞控",其实是重力加速度计和陀螺仪的组合,因为多用于控制飞行器的平衡(无人机.遥控飞机).有同学会问,这货为什么会有六轴呢?咱们常见的不是X.Y.Z三轴吗?重力加速度有三轴, ...

  2. JAVA中Abstract到底有什么用?都用在哪些方面比较合适?

    功能向上聚合 Abstract作为抽象类和抽象方法,第一种情况是在聚合子类的通用性上起到作用,往往出现在重构过程中自然而然形成的一种层次结构-希望将多个子类的通用方法和逻辑提取到父层的抽象类. 这种重 ...

  3. Windows反调试技术(下)

    OD的DBGHELP模块 检测DBGHELP模块,此模块是用来加载调试符号的,所以一般加载此模块的进程的进程就是调试器.绕过方法也很简单,将DBGHELP.DLL改名. #include <Wi ...

  4. MySQL修改账号密码方法大全

    前言: 在日常使用数据库的过程中,难免会遇到需要修改账号密码的情景,比如密码太简单需要修改.密码过期需要修改.忘记密码需要修改等.本篇文章将会介绍需要修改密码的场景及修改密码的几种方式. 1.忘记 r ...

  5. appium等待元素

    1.sleep()方法 Thread.sleep(60000)强制等待60s 2.隐式等待implicitlyWait() driver.manage().timeouts().implicitlyW ...

  6. Django(32)自定义过滤器

    前言 虽然DTL给我们内置了许多好用的过滤器.但是有些时候还是不能满足我们的需求.因此Django给我们提供了一个接口,可以让我们自定义过滤器,实现自己的需求. 自定义过滤器 首先在某个app中,创建 ...

  7. 通过Cloudflare开启全站https

    Cloudflare 添加域名后,会自动生成通用证书,快速开启全站HTTPS,服务端不用做任何修改,还可以选择多种开启模式 一.注册Cloudflare账号 直接打开网站:https://www.cl ...

  8. 用JIRA管理你的项目——(一)JIRA环境搭建

    JIRA,大家应该都已经不陌生了! 最初接触这个工具的时候,我还在一味地单纯依靠SVN管理代码,幻想着SVN可以有个邮件通知,至少在项目成员进行代码修改的时候,我可以第一时间通过邮件获得这个消息! 当 ...

  9. [Qt] 事件机制(四)

    滚轮事件:滚动滚轮实现窗口大小缩放 widget.h中增加: protected: void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; void ...

  10. teprunner测试平台定时任务这次终于稳了

    teprunner测试平台已经有一个多月没有更新了,主要原因是定时任务不够稳定,经过反复试错,找到了解决办法,这次终于稳定了. 本文开发内容 作为测试平台而言,定时任务算是必备要素了,只有跑起来的自动 ...