EasyFlash 的使用感受

Posted 快乐的老鼠

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了EasyFlash 的使用感受相关的知识,希望对你有一定的参考价值。

我的硬件是W25Q32 + STM32F401CE

配置如下:

/* The minimum size of flash erasure. May be a flash sector size. */
#define EF_ERASE_MIN_SIZE      4096   /* @note you must define it for a value */

/* the flash write granularity, unit: bit
 * only support 1(nor flash)/ 8(stm32f4)/ 32(stm32f1) */
#define EF_WRITE_GRAN         1    /* @note you must define it for a value */

/* backup area start address */
#define EF_START_ADDR             (0)	/* @note you must define it for a value */

/* ENV area size. It's at least one empty sector for GC. So it's definition must more then or equal 2 flash sector size. */
//ENV 区域大小。 GC 至少有一个空扇区。 所以它的定义必须大于或等于 2 个闪存扇区大小。
#define ENV_AREA_SIZE             (5 * EF_ERASE_MIN_SIZE) /* @note you must define it for a value if you used ENV */

/* saved log area size */
#define LOG_AREA_SIZE             (25 * EF_ERASE_MIN_SIZE) /* @note you must define it for a value if you used log */

/* print debug information of flash */
//#define PRINT_DEBUG
#define EF_ENV_USING_WL_MODE		//启用擦写平衡功能
#define EF_ENV_USING_PFS_MODE		//启用掉电恢复功能
#define EF_ENV_AUTO_UPDATE			//启用自动增量功能

首次开机的时候的日志

ENV start address is 0x00000000, size is 20480 bytes.
	ef_port_read() addr=0x0000, sector=0, size=16...
Warning: Sector header check failed. Format this sector (0x00000000).
	xxxxxxxxxxxxxx ef_port_erase() addr=0x0000, sector=0, size=4096...
	############# ef_port_write() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x1000, sector=1, size=16...
Warning: Sector header check failed. Format this sector (0x00001000).
	xxxxxxxxxxxxxx ef_port_erase() addr=0x1000, sector=1, size=4096...
	############# ef_port_write() addr=0x1000, sector=1, size=16...
	ef_port_read() addr=0x2000, sector=2, size=16...
Warning: Sector header check failed. Format this sector (0x00002000).
	xxxxxxxxxxxxxx ef_port_erase() addr=0x2000, sector=2, size=4096...
	############# ef_port_write() addr=0x2000, sector=2, size=16...
	ef_port_read() addr=0x3000, sector=3, size=16...
Warning: Sector header check failed. Format this sector (0x00003000).
	xxxxxxxxxxxxxx ef_port_erase() addr=0x3000, sector=3, size=4096...
	############# ef_port_write() addr=0x3000, sector=3, size=16...
	ef_port_read() addr=0x4000, sector=4, size=16...
Warning: Sector header check failed. Format this sector (0x00004000).
	xxxxxxxxxxxxxx ef_port_erase() addr=0x4000, sector=4, size=4096...
	############# ef_port_write() addr=0x4000, sector=4, size=16...
Warning: All sector header check failed. Set it to default.
xxxxxxxxxxxxxx ef_port_erase() addr=0x0000, sector=0, size=4096...
	############# ef_port_write() addr=0x0000, sector=0, size=16...
	xxxxxxxxxxxxxx ef_port_erase() addr=0x1000, sector=1, size=4096...
	############# ef_port_write() addr=0x1000, sector=1, size=16...
	xxxxxxxxxxxxxx ef_port_erase() addr=0x2000, sector=2, size=4096...
	############# ef_port_write() addr=0x2000, sector=2, size=16...
	xxxxxxxxxxxxxx ef_port_erase() addr=0x3000, sector=3, size=4096...
	############# ef_port_write() addr=0x3000, sector=3, size=16...
	xxxxxxxxxxxxxx ef_port_erase() addr=0x4000, sector=4, size=4096...
	############# ef_port_write() addr=0x4000, sector=4, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x1000, sector=1, size=16...
	ef_port_read() addr=0x2000, sector=2, size=16...
	ef_port_read() addr=0x3000, sector=3, size=16...
	ef_port_read() addr=0x4000, sector=4, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	############# ef_port_write() addr=0x0000, sector=0, size=1...
	############# ef_port_write() addr=0x0010, sector=0, size=1...
	############# ef_port_write() addr=0x0014, sector=0, size=20...
	############# ef_port_write() addr=0x0028, sector=0, size=10...
	############# ef_port_write() addr=0x0032, sector=0, size=1...
	############# ef_port_write() addr=0x0010, sector=0, size=1...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x1000, sector=1, size=16...
	ef_port_read() addr=0x2000, sector=2, size=16...
	ef_port_read() addr=0x3000, sector=3, size=16...
	ef_port_read() addr=0x4000, sector=4, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x0010, sector=0, size=24...
	ef_port_read() addr=0x0020, sector=0, size=19...
	ef_port_read() addr=0x0028, sector=0, size=10...
	ef_port_read() addr=0x1000, sector=1, size=16...
	ef_port_read() addr=0x2000, sector=2, size=16...
	ef_port_read() addr=0x3000, sector=3, size=16...
	ef_port_read() addr=0x4000, sector=4, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x0010, sector=0, size=24...
	ef_port_read() addr=0x0020, sector=0, size=19...
	ef_port_read() addr=0x0028, sector=0, size=10...
	ef_port_read() addr=0x1000, sector=1, size=16...
	ef_port_read() addr=0x2000, sector=2, size=16...
    ef_port_read() addr=0x3000, sector=3, size=16...
	ef_port_read() addr=0x4000, sector=4, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x1000, sector=1, size=16...
	ef_port_read() addr=0x2000, sector=2, size=16...
	ef_port_read() addr=0x3000, sector=3, size=16...
	ef_port_read() addr=0x4000, sector=4, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x0010, sector=0, size=24...
	ef_port_read() addr=0x0020, sector=0, size=19...
	ef_port_read() addr=0x0028, sector=0, size=10...
	ef_port_read() addr=0x1000, sector=1, size=16...
	ef_port_read() addr=0x2000, sector=2, size=16...
	ef_port_read() addr=0x3000, sector=3, size=16...
	ef_port_read() addr=0x4000, sector=4, size=16...
	############# ef_port_write() addr=0x0033, sector=0, size=1...
	############# ef_port_write() addr=0x0037, sector=0, size=20...
	############# ef_port_write() addr=0x004B, sector=0, size=11...
	############# ef_port_write() addr=0x0056, sector=0, size=4...
	############# ef_port_write() addr=0x0033, sector=0, size=1...
EasyFlash V4.1.99 is initialize success.
You can get the latest version on https://github.com/armink/EasyFlash .

我的测试结构体是: 

typedef struct {
	char a;
	short b;
	int c;
	float d;
	double e;
} test_data_t;

 

触发一次写操作:

------------------> ef_set_env_blob()...	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x1000, sector=1, size=16...
	ef_port_read() addr=0x2000, sector=2, size=16...
	ef_port_read() addr=0x3000, sector=3, size=16...
	ef_port_read() addr=0x4000, sector=4, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x0072, sector=0, size=32...
	ef_port_read() addr=0x005A, sector=0, size=24...
	ef_port_read() addr=0x006A, sector=0, size=32...
	ef_port_read() addr=0x008A, sector=0, size=9...
	ef_port_read() addr=0x0072, sector=0, size=9...
	############# ef_port_write() addr=0x005A, sector=0, size=1...
	ef_port_read() addr=0x0001, sector=0, size=1...
	############# ef_port_write() addr=0x0001, sector=0, size=1...
	############# ef_port_write() addr=0x0093, sector=0, size=1...
	############# ef_port_write() addr=0x0097, sector=0, size=20...
	############# ef_port_write() addr=0x00AB, sector=0, size=9...
	############# ef_port_write() addr=0x00B4, sector=0, size=24...
	############# ef_port_write() addr=0x0093, sector=0, size=1...
	############# ef_port_write() addr=0x005A, sector=0, size=1...
	ef_port_read() addr=0x0001, sector=0, size=1...

有没有发现 sector0扇区读了很多次,我们是否可以这样优化代码:当连续读同一个扇区时候,就可以将该扇区整个读出来,放到cache中呢?

下面我们来试试开启cache后的开机:

ENV start address is 0x00000000, size is 20480 bytes.
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x1000, sector=1, size=16...
	ef_port_read() addr=0x2000, sector=2, size=16...
	ef_port_read() addr=0x3000, sector=3, size=16...
	ef_port_read() addr=0x4000, sector=4, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x1000, sector=1, size=16...
	ef_port_read() addr=0x2000, sector=2, size=16...
	ef_port_read() addr=0x3000, sector=3, size=16...
	ef_port_read() addr=0x4000, sector=4, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x0010, sector=0, size=24...	(copy sector to cache)
	ef_port_read() addr=0x0020, sector=0, size=19...	(hit cache~)
	ef_port_read() addr=0x0028, sector=0, size=10...	(hit cache~)
	ef_port_read() addr=0x0033, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0033, sector=0, size=24...	(hit cache~)
	ef_port_read() addr=0x0043, sector=0, size=23...	(hit cache~)
	ef_port_read() addr=0x004B, sector=0, size=11...	(hit cache~)
	ef_port_read() addr=0x005A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x005A, sector=0, size=24...	(hit cache~)
	ef_port_read() addr=0x006A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x008A, sector=0, size=9...	(hit cache~)
	ef_port_read() addr=0x0072, sector=0, size=9...	(hit cache~)
	ef_port_read() addr=0x0093, sector=0, size=32...	(hit cache~)
    ef_port_read() addr=0x0093, sector=0, size=24...	(hit cache~)
	ef_port_read() addr=0x00A3, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x00C3, sector=0, size=9...	(hit cache~)
	ef_port_read() addr=0x00AB, sector=0, size=9...	(hit cache~)
	ef_port_read() addr=0x00CC, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x00CC, sector=0, size=24...	(hit cache~)
	ef_port_read() addr=0x00DC, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x00FC, sector=0, size=9...	(hit cache~)
	ef_port_read() addr=0x00E4, sector=0, size=9...	(hit cache~)
	ef_port_read() addr=0x0105, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0105, sector=0, size=24...	(hit cache~)
	ef_port_read() addr=0x0115, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0135, sector=0, size=9...	(hit cache~)
	ef_port_read() addr=0x011D, sector=0, size=9...	(hit cache~)
	ef_port_read() addr=0x013E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x015A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0176, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0192, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x01AE, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x01CA, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x01E6, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0202, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x021E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x023A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0256, sector=0, size=32...	(hit cache~)
    ef_port_read() addr=0x0272, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x028E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x02AA, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x02C6, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x02E2, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x02FE, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x031A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0336, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0352, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x036E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x038A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x03A6, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x03C2, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x03DE, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x03FA, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0416, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0432, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x044E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x046A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0486, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x04A2, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x04BE, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x04DA, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x04F6, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0512, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x052E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x054A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0566, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0582, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x059E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x05BA, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x05D6, sector=0, size=32...	(hit cache~)
    ef_port_read() addr=0x05F2, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x060E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x062A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0646, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0662, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x067E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x069A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x06B6, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x06D2, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x06EE, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x070A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0726, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0742, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x075E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x077A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0796, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x07B2, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x07CE, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x07EA, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0806, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0822, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x083E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x085A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0876, sector=0, size=32...	(hit cache~)
    ef_port_read() addr=0x0892, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x08AE, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x08CA, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x08E6, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0902, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x091E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x093A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0956, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0972, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x098E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x09AA, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x09C6, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x09E2, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x09FE, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0A1A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0A36, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0A52, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0A6E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0A8A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0AA6, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0AC2, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0ADE, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0AFA, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0B16, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0B32, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0B4E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0B6A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0B86, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0BA2, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0BBE, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0BDA, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0BF6, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0C12, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0C2E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0C4A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0C66, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0C82, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0C9E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0CBA, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0CD6, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0CF2, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0D0E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0D2A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0D46, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0D62, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0D7E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0D9A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0DB6, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0DD2, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0DEE, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0E0A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0E26, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0E42, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0E5E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0E7A, sector=0, size=32...	(hit cache~)
    ef_port_read() addr=0x0E96, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0EB2, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0ECE, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0EEA, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0F06, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0F22, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0F3E, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0F5A, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0F76, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0F92, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0FAE, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0FCA, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0FE6, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x1000, sector=1, size=16...
	ef_port_read() addr=0x2000, sector=2, size=16...
	ef_port_read() addr=0x3000, sector=3, size=16...
	ef_port_read() addr=0x4000, sector=4, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x0010, sector=0, size=24...	(hit cache~)
	ef_port_read() addr=0x0020, sector=0, size=19...	(hit cache~)
	ef_port_read() addr=0x0028, sector=0, size=10...	(hit cache~)
	ef_port_read() addr=0x0033, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x0033, sector=0, size=24...	(hit cache~)
	ef_port_read() addr=0x0043, sector=0, size=23...	(hit cache~)
	ef_port_read() addr=0x004B, sector=0, size=11...	(hit cache~)
	ef_port_read() addr=0x0056, sector=0, size=4...	(hit cache~)
EasyFlash V4.1.99 is initialize success.
You can get the latest version on https://github.com/armink/EasyFlash .

写一条记录:

------------------> ef_set_env_blob()...	ef_port_read() addr=0x0000, sector=0, size=16...	(hit cache~)
	ef_port_read() addr=0x1000, sector=1, size=16...
	ef_port_read() addr=0x2000, sector=2, size=16...
	ef_port_read() addr=0x3000, sector=3, size=16...
	ef_port_read() addr=0x4000, sector=4, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...
	ef_port_read() addr=0x0000, sector=0, size=16...	(hit cache~)
	ef_port_read() addr=0x00E4, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x00CC, sector=0, size=24...	(hit cache~)
	ef_port_read() addr=0x00DC, sector=0, size=32...	(hit cache~)
	ef_port_read() addr=0x00FC, sector=0, size=9...	(hit cache~)
	ef_port_read() addr=0x00E4, sector=0, size=9...	(hit cache~)
	############# ef_port_write() addr=0x00CC, sector=0, size=1...
	ef_port_read() addr=0x0001, sector=0, size=1...	(hit cache~)
	############# ef_port_write() addr=0x0105, sector=0, size=1...
	############# ef_port_write() addr=0x0109, sector=0, size=20...
	############# ef_port_write() addr=0x011D, sector=0, size=9...
	############# ef_port_write() addr=0x0126, sector=0, size=24...
	############# ef_port_write() addr=0x0105, sector=0, size=1...
	############# ef_port_write() addr=0x00CC, sector=0, size=1...
	ef_port_read() addr=0x0001, sector=0, size=1...	(hit cache~)

对比发现开启cache后, 基本上都可以被命中,这样存储速度会大幅度提高,粗略测试快15倍。

 

 

以上是关于EasyFlash 的使用感受的主要内容,如果未能解决你的问题,请参考以下文章

SFUD+FAL+EasyFlash典型场景需求分析,并记一次实操记录

带你尝鲜LiteOS 组件EasyFlash

码云最有价值开源项目:EasyFlash

EasyFlash 里的 EF_WRITE_GRAN

EasyFlash 里的 EF_WRITE_GRAN

EasyFlash V4.0 ENV 功能设计与实现