EasyFlash
EasyFlash copied to clipboard
Lightweight IoT device information storage solution: KV/IAP/LOG. | 轻量级物联网设备信息存储方案:参数存储、在线升级及日志存储 ,全新一代版本请移步至 https://github.com/armink/FlashDB
目的:提高读取速度,减少cache miss几率 实现:使用迭代器从头检索key更新到cache table,直至cache table已满或检索完毕
啥时候能支持大数据存储啊(礼貌提问)
`static EfErrCode log_seq_read(uint32_t addr, uint32_t *log, size_t size) { EfErrCode result = EF_NO_ERR; size_t read_size = 0, read_size_temp = 0; while (size) { /* move to sector data address */...
当前的软件CRC查表实现略大,表大约要1k的flash,对于某些flash紧张的单片机可以优化点。 但是软件算法的多项式似乎是0xEDB88320,硬件CRC的很多都是0x4C11DB7,比如ch32v20x、stm32f410之类的。 不过似乎应该只要写入时和读取校验时的CRC计算方式一样就行吧,这样对于不同单片机的硬件不同算法关系也不大?
以前是3.x版本,STM32F401RCT6,Freertos,M24C32。EasyFlash跑在4KB的24C32上,读写函数是自写使用硬件I2C的读写函数。一切正常。 现在更新到4.1,有几个问题: 1,Write Gran 应该是多少?我认为是8 2,Sector设多少合适,我用1024 3,现在单步跑到写24C32的代码会引发HardFault,BFARVALID,PRECISERR,FORCED置位;使用cm_backtrace提示freertos的defaultThread stackoverflow,但是把stack size从1KB增大到4KB都无效。 ` [Flash](..\Src\KLibs\easyflash\src\ef_env.c:1831) ENV start address is 0x00000000, size is 4096 bytes. [Flash]Warning: Sector header check failed. Format this sector (0x00000400). [Flash]Warning:...
16KB , 四个扇区,每个扇区都一样的内容。修改数据时,提示EF_ENV_FULL。 
find_start_and_end_addr函数,358行和373行有如下的逻辑,发现setor status是错误,会调用ef_log_clean。 case SECTOR_STATUS_HEADER_ERROR: EF_DEBUG("Error: Log sector header error! Now will clean all log area.\n"); ef_log_clean(); return; 如果在调用ef_log_write 写入log的过程中,刚好在ef_port_erase时复位或掉电,此时有一个sector的内容为全FFFF(或没擦完内容错误),再次上电时会吧整个log都清除了。 在log区域写满的情况下继续写入log(因为会经常erase setor),这个log全部丢失的问题出现的概率会很大。 是否考虑针对此场景,修改一下find_start_and_end_addr函数的逻辑?
 这是适配的问题吗,还是什么其他问题?起始地址被修改了
Hi armink, It's better to add a "remaining length" check before this line. https://github.com/armink/EasyFlash/blob/f732982f71c015def3d5a84e72abcd4411ca1d9b/easyflash/src/ef_log.c#L681 For example: `if (size - write_size == 0)`, then we should not call the ef_port_write() function....