標(biāo)題: 適合flash的輕量級(jí)文件系統(tǒng)littlefs [打印本頁]

作者: mysohu150    時(shí)間: 2019-12-2 15:15
標(biāo)題: 適合flash的輕量級(jí)文件系統(tǒng)littlefs
         很多嵌入式系統(tǒng)喜歡用fatfs, 但是如果是使用flash作為介質(zhì),在erase和平衡處理上會(huì)變得比較麻煩!
LittleFS是一個(gè)高度完整的嵌入式文件系統(tǒng),實(shí)現(xiàn)了磨損平衡支持。
開源地址:
https://github.com/armmbed/mbed-littlefs

具有幾個(gè)優(yōu)點(diǎn):
1:斷電恢復(fù)能力 - 要求文件系統(tǒng)保持一致,并將數(shù)據(jù)刷新到底層存儲(chǔ)。
2:平均磨損 - 通常情況下,存儲(chǔ)支持每塊數(shù)量有限的擦除,因此使用整個(gè)存儲(chǔ)設(shè)備對(duì)于可靠性非常重要。
3:微小的占地面積 - 物聯(lián)網(wǎng)設(shè)備受到ROM和RAM的限制。占地面積小可以節(jié)省資金。

項(xiàng)目工程中,自帶了測(cè)試腳本。
功能測(cè)試 - mbed test -n 'features-filesystem-littlefs-tests-filesystem-*'。
重新測(cè)試 - mbed test -n 'features-filesystem-littlefs-tests-filesystem_retarget-*'。
磨平測(cè)試 - mbed test -n 'features-filesystem-littlefs-tests-filesystem_recovery-wear_leveling'。
模擬功率彈性測(cè)試mbed test -n 'features-filesystem-littlefs-tests-filesystem_recovery-resilience'。
硬件功率彈性測(cè)試mbed test -n 'features-filesystem-littlefs-tests-filesystem_recovery-resilience_functional'


對(duì)于硬件平臺(tái)的移植也非常簡(jiǎn)單,只要實(shí)現(xiàn)幾個(gè)簡(jiǎn)單的接口函數(shù)就可以了。

const struct lfs_config cfg = {
    // block device operations
    .read  = user_provided_block_device_read,
    .prog  = user_provided_block_device_prog,
    .erase = user_provided_block_device_erase,
    .sync  = user_provided_block_device_sync,

    // block device configuration
    .read_size = 16,
    .prog_size = 16,
    .block_size = 4096,
    .block_count = 128,
    .lookahead = 128,


}





歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1