arm - LittleFS 在我尝试挂载时返回 LFS_ERR_CORRUPT 和 LFS_ERR_NOSPC
问题描述
我正在将 LittleFS 移植到我正在处理的项目中,当我尝试安装它时,它返回 -84(已损坏)。在那之后,我格式化文件系统并尝试重新挂载它,然后它返回 -28(设备上没有剩余空间)。
这是我要实现的代码:
/* variables used by the filesystem */
const U8 lfs_read_buf[256];
const U8 lfs_prog_buf[256];
const U8 lfs_lookahead_buf[16];
lfs_t lfs;
/* configuration of the filesystem is provided by this struct */
const struct lfs_config cfg = {
// block device operations
.read = FLASHEx_block_read,
.prog = FLASHEx_block_write,
.erase = FLASHEx_block_erase,
.sync = FLASHEx_block_sync,
// block device configuration
.read_size = 256,
.prog_size = 256,
.block_size = 4096,
.block_count = 3072, // The block count is actually 4096, but I lowered it to test. (Failed.)
.cache_size = 256,
.lookahead_size = 256,
.block_cycles = 200,
.read_buffer = (void*)lfs_read_buf,
.prog_buffer = (void*)lfs_prog_buf,
.lookahead_buffer = (void*)lfs_lookahead_buf,
};
// mount the filesystem
int err = lfs_mount(&lfs, &cfg); // Returns LFS_ERR_CORRUPT (-84, "Corrupted")
// reformat to try to re-mount the filesystem
if (err) {
err = lfs_format(&lfs, &cfg); // Returns -28 (no space left on device).
err = lfs_mount(&lfs, &cfg); // Returns -28 (no space left on device).
}
我使用的外部闪存模块是Winbond W25Q128JV。
我的实现基于这篇网络文章和LittleFS 文档示例。
任何人都可以阐明使它起作用吗?
谢谢你。
解决方案
推荐阅读
- python - 什么定义了 Excel.Application COM 对象连接到哪个 Excel 实例?
- haskell - Haskell 中的函数缩减是如何工作的?
- php - PHP CRUD API 不断返回 JSON 值的 Base64
- excel - Excel:查找数据子集的中位数
- android - 在 Android 中向 LiveData 传递值
- image - 代码不适用于更大的 for 循环值
- python - 将 Web Scraping 的结果存储到数据库中
- c - 时间 execv 调用的程序的持续时间
- python - 词典链接
- python - 有没有办法使用 Python 检索文件名?