Chinaunix首页 | 论坛 | 博客
  • 博客访问: 63167
  • 博文数量: 14
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 130
  • 用 户 组: 普通用户
  • 注册时间: 2015-03-21 13:33
个人简介

业精于勤,荒于嬉;行成于思,毁于随。

文章分类

全部博文(14)

分类: 嵌入式

2017-11-21 01:09:46

ef_cfg.h     配置文件

点击(此处)折叠或打开

  1. #ifndef EF_CFG_H_
  2. #define EF_CFG_H_

  3. /* using ENV function */
  4. #define EF_USING_ENV
  5. /* using wear leveling mode for ENV */
  6. /* #define EF_ENV_USING_WL_MODE */
  7. /* using power fail safeguard mode for ENV */
  8. /* #define EF_ENV_USING_PFS_MODE */

  9. /* using IAP function */
  10. #define EF_USING_IAP

  11. /* using save log function */
  12. /* #define EF_USING_LOG */

  13. /* the minimum size of flash erasure */
  14. #define EF_ERASE_MIN_SIZE /* @note you must define it for a value */

  15. /**
  16.  *
  17.  * This all Backup Area Flash storage index. All used flash area configure is under here.
  18.  * |----------------------------| Storage Size
  19.  * | Environment variables area | ENV area size @see ENV_AREA_SIZE
  20.  * | 1.system section | ENV_SYSTEM_SIZE
  21.  * | 2:data section | ENV_AREA_SIZE - ENV_SYSTEM_SIZE
  22.  * |----------------------------|
  23.  * | Saved log area | Log area size @see LOG_AREA_SIZE
  24.  * |----------------------------|
  25.  * |(IAP)Downloaded application | IAP already downloaded application, unfixed size
  26.  * |----------------------------|
  27.  *
  28.  * @note all area size must be aligned with EF_ERASE_MIN_SIZE
  29.  * @note EasyFlash will use ram to buffered the ENV. At some time flash's EF_ERASE_MIN_SIZE is so big,
  30.  * and you want use ENV size is less than it. So you must defined ENV_USER_SETTING_SIZE for ENV.
  31.  * @note ENV area size has some limitations in different modes.
  32.  * 1.Normal mode: no more limitations
  33.  * 2.Wear leveling mode: system section will used an flash section and the data section will used at least 2 flash sections
  34.  * 3.Power fail safeguard mode: ENV area will has an backup. It is twice as normal mode.
  35.  * 4.wear leveling and power fail safeguard mode: The required capacity will be 2 times the total capacity in wear leveling mode.
  36.  * For example:
  37.  * The EF_ERASE_MIN_SIZE is 128K and the ENV_USER_SETTING_SIZE: 2K. The ENV_AREA_SIZE in different mode you can define
  38.  * 1.Normal mode: 1*EF_ERASE_MIN_SIZE
  39.  * 2.Wear leveling mode: 3*EF_ERASE_MIN_SIZE (It has 2 data section to store ENV. So ENV can erase at least 200,000 times)
  40.  * 3.Power fail safeguard mode: 2*EF_ERASE_MIN_SIZE
  41.  * 4.Wear leveling and power fail safeguard mode: 6*EF_ERASE_MIN_SIZE
  42.  * @note the log area size must be more than twice of EF_ERASE_MIN_SIZE
  43.  */
  44. /* backup area start address */
  45. #define EF_START_ADDR /* @note you must define it for a value */
  46. /* the user setting size of ENV, must be word alignment */
  47. #define ENV_USER_SETTING_SIZE /* @note you must define it for a value if you used ENV */
  48. /* ENV area total bytes size in normal mode. */
  49. #define ENV_AREA_SIZE /* @note you must define it for a value if you used ENV */
  50. /* saved log area size */
  51. #define LOG_AREA_SIZE /* @note you must define it for a value if you used log */

  52. /* print debug information of flash */
  53. #define PRINT_DEBUG

  54. #endif /* EF_CFG_H_ */

从上图可以看出,存储分为了三个区,环境变量区(包含了系统区和数据区)、日志区和在线升级区。
可选择宏(注释掉就表示关闭对应的功能):
PRINT_DEBUG /* print debug information of flash */ 使用调试功能
EF_USING_IAP /* using IAP function */              使用IAP 功能
EF_USING_LOG /* using save log function */       使用日志功能


EF_USING_ENV  /* using ENV function */使用环境功能  
EF_ENV_USING_WL_MODE /* using wear leveling mode for ENV */ 使用损坏均衡环境功能
EF_ENV_USING_PFS_MODE /* using power fail safeguard mode for ENV */使用掉电保护环境功能
上面三者之间的区别:
 *       1.Normal mode: no more limitations
 *       2.Wear leveling mode: system section will used an flash section and the data section will used at least 2 flash sections
 *       3.Power fail safeguard mode: ENV area will has an backup. It is twice as normal mode.
 *       4.wear leveling and power fail safeguard mode: The required capacity will be 2 times the total capacity in wear leveling mode.
1.EF_USING_ENV:  属于普通的模式,没有太多的限制
2.EF_ENV_USING_WL_MODE :使用损坏均衡模式,系统区会使用一个flash扇区,数据区会至少使用两个flash扇区
3.EF_ENV_USING_PFS_MODE && EF_ENV_USING_WL_MODE :flash使用是EF_ENV_USING_WL_MODE 模式下的两倍容量



注释为 /* @note you must define it for a value if you used ENV */ 是必须定义值的宏:
/* the minimum size of flash erasure */
#define EF_ERASE_MIN_SIZE        擦除的最小值

/* backup area start address */
#define EF_START_ADDR    备份区的开始地址
       
/* the user setting size of ENV, must be word alignment */
#define ENV_USER_SETTING_SIZE     用户环境区大小

/* ENV area total bytes size in normal mode. */
#define ENV_AREA_SIZE         环境区大小
   
/* saved log area size */
#define LOG_AREA_SIZE          日志区大小


    本文乃黎社林原创文章,如有错误,请联系lishelin0505@163.com




阅读(2298) | 评论(0) | 转发(0) |
0

上一篇:EasyFlash概述

下一篇:EasyFlash 移植(一)

给主人留下些什么吧!~~