当前位置:网站首页>关于easyflash v3.3使用过程的记录
关于easyflash v3.3使用过程的记录
2022-07-07 08:23:00 【Sky_Lannister】
开源地址https://github.com/armink/EasyFlash
开源作者的一个帖子:https://www.amobbs.com/thread-5624863-1-1.html
已经更到V4了,但是使用的是ST的L4系列单片机,不能逆序写入,所以还是用的V3版本
使用的时候偶尔出现过空间已满,还特别不好复现,就把源代码过了一遍
关于磨损平衡
不是真正的磨损平衡,只是先一直向一个扇区不断的擦写读,等把这个扇区写坏了,再往下平移一个扇区,而且是只要这个扇区里面有一次写或者擦除失败都会平移到下一扇区,V4的实现和V3完全不一样关于env删除和复位:
/* remain ENV move forward */
memcpy(del_env, del_env + del_env_length, remain_env_length);
删除某个键值对后,缓存区数据统一向前平移 然后设置结尾地址;
将当前使用地址之后的缓存区域(env_cache)大小擦除,然后将移位好的数据从当前地址写入
save_cur_using_data_addr是写入前16字节的导头数据到系统区;
删除的时候会有一个空间保存一组每次复位都会保存的数据关于掉电保护:
掉电保护是通过软件实现的,不是通过检测单片机电压低于某个值后进行保存,而是调用ef_save_env_wt的时候,一次写入后几k备份,一次写入前几k真正保存,两次来回往复,始终有一个是另一个的保存,但是这样造成空间的浪费关于 get_env_user_used_size(void) 的理解:
static size_t get_env_user_used_size(void) {
if (get_env_detail_end_addr() > get_cur_using_data_addr()) {
return get_env_detail_end_addr() - get_cur_using_data_addr();
} else {
return 0;
}
}
为什么获取已经用过的大小,是通过末尾地址减去正在使用的地址,正序倒序都理解不了?
实际应该理解为get_env_detail_end_addr()是使用的末尾地址,是一直根据写入的大小改变的,而get_cur_using_data_addr();是固定的两个值,即要不是备份区,要不是真正存储区关于env空间分配:
掉电和磨损平衡模式,前后内存区分布一致:1系统区、2数据区
注意缓存区RAM大小、环境变量区、最小擦除扇区的大小及彼此的关系关于常存数据区大小:
default_env_set_size:一直保存的KEY-VALUE 复位的时候将其写入缓存的最后区域
使用set_env_detail_end_addr(get_env_detail_end_addr() + env_str_len);设置进去常存内容
边栏推荐
- The method of word automatically generating directory
- 搭建物联网硬件通信技术几种方案
- 浅谈日志中的返回格式封装格式处理,异常处理
- 嵌入式工程师如何提高工作效率
- gym安装踩坑记录
- Learning records - high precision addition and multiplication
- 原型与原型链
- Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software
- P1223 排队接水/1319:【例6.1】排队接水
- ThreadLocal会用可不够
猜你喜欢
1324:【例6.6】整数区间
mysql插入数据创建触发器填充uuid字段值
P1223 排队接水/1319:【例6.1】排队接水
This article explains the complex relationship between MCU, arm, muc, DSP, FPGA and embedded system
Several schemes of building hardware communication technology of Internet of things
The method of word automatically generating directory
Leetcode-560: subarray with sum K
Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software
Vs code specifies the extension installation location
Application of OpenGL gllightfv function and related knowledge of light source
随机推荐
The Hal library is configured with a general timer Tim to trigger ADC sampling, and then DMA is moved to the memory space.
【acwing】786. Number k
[牛客网刷题 Day5] JZ77 按之字形顺序打印二叉树
BigDecimal value comparison
Chris Lattner, père de llvm: Pourquoi reconstruire le logiciel d'infrastructure ai
Several schemes of building hardware communication technology of Internet of things
0x0fa23729 (vcruntime140d.dll) (in classes and objects - encapsulation.Exe) exception thrown (resolved)
When there are pointer variable members in the custom type, the return value and parameters of the assignment operator overload must be reference types
对word2vec的一些浅层理解
A small problem of bit field and symbol expansion
[detailed explanation of Huawei machine test] tall and short people queue up
leetcode-560:和为 K 的子数组
Easyexcel read write simple to use
. Net configuration system
优雅的 Controller 层代码
Learning records - high precision addition and multiplication
Elegant controller layer code
OpenGL glLightfv 函数的应用以及光源的相关知识
mysql插入数据创建触发器填充uuid字段值
施努卡:机器视觉定位技术 机器视觉定位原理