armink / FlashDB

An ultra-lightweight database that supports key-value and time series data | 一款支持 KV 数据和时序数据的超轻量级数据库
Apache License 2.0
1.83k stars 420 forks source link

时序数据库每次上电都进行格式化问题 #85

Open leven99 opened 3 years ago

leven99 commented 3 years ago

初始化如下: ... sfud_init(); fal_init(); fdb_tsdb_init(&s_chargedb, "chargedb", NOR_FLASH_PART1_NAME, get_time, 512, NULL); ...

每次上电都会重新格式化扇区,并且分区表的起始地址不正确。

日志如下: [SFUD] (../3rdparty/sfud/src/sfud.c:117) Start initialize Serial Flash Universal Driver(SFUD) V1.1.0. [SFUD] (../3rdparty/sfud/src/sfud.c:866) The flash device manufacturer ID is 0xEF, memory type ID is 0x40, capacity ID is 0x17. [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:132) Check SFDP header is OK. The reversion is V1.5, NPN is 0. [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:175) Check JEDEC basic flash parameter header is OK. The table id is 0, reversion is V1.5, length is 16, parameter table pointer is 0x000080. [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:203) JEDEC basic flash parameter table info: [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:204) MSB-LSB 3 2 1 0 [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:207) [0001] 0xFF 0xF9 0x20 0xE5 [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:207) [0002] 0x03 0xFF 0xFF 0xFF [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:207) [0003] 0x6B 0x08 0xEB 0x44 [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:207) [0004] 0xBB 0x42 0x3B 0x08 [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:207) [0005] 0xFF 0xFF 0xFF 0xFE [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:207) [0006] 0x00 0x00 0xFF 0xFF [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:207) [0007] 0xEB 0x40 0xFF 0xFF [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:207) [0008] 0x52 0x0F 0x20 0x0C [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:207) [0009] 0x00 0x00 0xD8 0x10 [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:215) 4 KB Erase is supported throughout the device. Command is 0x20. [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:234) Write granularity is 64 bytes or larger. [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:245) Target flash status register is non-volatile. [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:271) 3-Byte only addressing. [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:305) Capacity is 8388608 Bytes. [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:312) Flash device supports 4KB block erase. Command is 0x20. [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:312) Flash device supports 32KB block erase. Command is 0x52. [SFUD] (../3rdparty/sfud/src/sfud_sfdp.c:312) Flash device supports 64KB block erase. Command is 0xD8. [SFUD] Find a Winbond flash chip. Size is 8388608 bytes. [SFUD] (../3rdparty/sfud/src/sfud.c:844) Flash device reset success. [SFUD] W25Q64CV flash device is initialize success. [D/FAL] Flash device | flash_dev: norflash0 | addr: 0x00000000 | len: 0x00800000 | blk_size: 0x00001000 | initialized finish. [I/FAL] ==================== FAL partition table ==================== [I/FAL] | ____name | flash_dev | offset | length | [I/FAL] ------------------------------------------------------------- [I/FAL] | faultrecord | norflash0 | 0x00000000 | 0x00200000 | [I/FAL] | chargerecord | norflash0 | 0x00200000 | 0x00200000 | [I/FAL] | reserve | norflash0 | 0x00400000 | 0x00200000 | [I/FAL] | ____download | norflash0 | 0x00600000 | 0x00200000 | [I/FAL] ============================================================= [I/FAL] Flash Abstraction Layer (V0.5.0) initialize success. [FlashDB][tsl][chargedb] Sector (0x00000000) header info is incorrect. [FlashDB][tsl][chargedb] All sector format finished. [FlashDB][tsl][chargedb] TSDB (chargedb) oldest sectors is 0x00000000, current using sector is 0x00000000.

armink commented 3 years ago

感觉你的 Flash 驱动是读写是不是有问题,正常不会这样子的,可以 demo 自带的工程效果