搜索
bottom↓
回复: 12

移植SPIFFS 0.3.7 的 一些疑问。

[复制链接]

出0入0汤圆

发表于 2017-7-27 15:43:39 | 显示全部楼层 |阅读模式
里面新加了一些东西,不知道意思:using File System Magic是什么意思?还有 filehandle offset是什么作用?


// test using filesystem magic
#ifndef SPIFFS_USE_MAGIC
#define SPIFFS_USE_MAGIC    0
#endif
// test using filesystem magic length
#ifndef SPIFFS_USE_MAGIC_LENGTH
#define SPIFFS_USE_MAGIC_LENGTH   0
#endif
// test using extra param in callback
#ifndef SPIFFS_HAL_CALLBACK_EXTRA
#define SPIFFS_HAL_CALLBACK_EXTRA       0
#endif
// test using filehandle offset
#ifndef SPIFFS_FILEHDL_OFFSET
#define SPIFFS_FILEHDL_OFFSET           0
// use this offset
#define TEST_SPIFFS_FILEHDL_OFFSET      0x1000
#endif

#ifdef NO_TEST
#define SPIFFS_LOCK(fs)
#define SPIFFS_UNLOCK(fs)
#else
struct spiffs_t;
extern void SPIFFSLock(struct spiffs_t *fs);
extern void SPIFFSUnlock(struct spiffs_t *fs);
#define SPIFFS_LOCK(fs)   SPIFFSLock(fs)
#define SPIFFS_UNLOCK(fs) SPIFFSUnlock(fs)
#endif

阿莫论坛20周年了!感谢大家的支持与爱护!!

月入3000的是反美的。收入3万是亲美的。收入30万是移民美国的。收入300万是取得绿卡后回国,教唆那些3000来反美的!

出0入0汤圆

 楼主| 发表于 2017-7-27 17:05:51 | 显示全部楼层
为什么我 EraseBulk()了,还能Mount成功?
那我格式化是应该用EraseBulk() 还是 SPIFFS_format()啊?

出0入8汤圆

发表于 2017-8-12 11:01:38 | 显示全部楼层
SPIFFS_USE_MAGIC

Enable this if you want to be able to recognize that the underlying structure on the SPI flash is indeed a spiffs file system at mount. See a discussion of this here. Otherwise, you're a bold person and assumes everything is ok without even looking at the flash at mount point.


SPIFFS_FILEHDL_OFFSET

Enable this if you want the spiffs filehandles to be offseted for a specific spiffs instance. Useful when running multiple spiffs instances in order to recognize to what spiffs instance a filehandle belongs.

SPIFFS 的文档说明做的非常详细,甚至有各种配置下的性能开销,建议楼主花点时间去读。

出0入0汤圆

 楼主| 发表于 2017-8-13 11:45:27 | 显示全部楼层
Jmhh247 发表于 2017-8-12 11:01
SPIFFS_USE_MAGIC

Enable this if you want to be able to recognize that the underlying structure on t ...

谢谢,已经看了

出0入0汤圆

 楼主| 发表于 2017-8-14 07:01:55 | 显示全部楼层
Jmhh247 发表于 2017-8-12 11:01
SPIFFS_USE_MAGIC

Enable this if you want to be able to recognize that the underlying structure on t ...

大侠,为什么我人配置,用4MB的Flash,只能写入约2MB的内容啊?

// Enable if only one spiffs instance with constant configuration will exist
// on the target. This will reduce calculations, flash and memory accesses.
// Parts of configuration must be defined below instead of at time of mount.
#ifndef SPIFFS_SINGLETON
#define SPIFFS_SINGLETON 1
#endif

#if SPIFFS_SINGLETON
// Instead of giving parameters in config struct, singleton build must
// give parameters in defines below.
#ifndef SPIFFS_CFG_PHYS_SZ
#define SPIFFS_CFG_PHYS_SZ(ignore)        (1024*1024*4)
#endif
#ifndef SPIFFS_CFG_PHYS_ERASE_SZ
#define SPIFFS_CFG_PHYS_ERASE_SZ(ignore)  (65536)
#endif
#ifndef SPIFFS_CFG_PHYS_ADDR
#define SPIFFS_CFG_PHYS_ADDR(ignore)      (0)
#endif
#ifndef SPIFFS_CFG_LOG_PAGE_SZ
#define SPIFFS_CFG_LOG_PAGE_SZ(ignore)    (256)
#endif
#ifndef SPIFFS_CFG_LOG_BLOCK_SZ
#define SPIFFS_CFG_LOG_BLOCK_SZ(ignore)   (65536)
#endif
#endif

出0入8汤圆

发表于 2017-8-14 09:29:45 | 显示全部楼层
dog 发表于 2017-8-14 07:01
大侠,为什么我人配置,用4MB的Flash,只能写入约2MB的内容啊?

// Enable if only one spiffs instance ...

这个我就不知道了,我只在2MB的Flash上用过spiffs,具体能写入多少也没测过。。。

出0入0汤圆

发表于 2017-11-10 22:44:52 | 显示全部楼层
我用2MB的Flash,只能写入不到1MB的内容,奇怪!

出0入0汤圆

 楼主| 发表于 2017-11-17 18:23:59 | 显示全部楼层
qzh 发表于 2017-11-10 22:44
我用2MB的Flash,只能写入不到1MB的内容,奇怪!

它是这个特性,我也是因此放弃了它,现在自己写了一个ROMFS,自己写了工具打包成ROM文件,然后自己写了一套 FS函数。

出0入0汤圆

发表于 2017-11-17 18:56:55 | 显示全部楼层
可能是为了掉电保护文件系统完整性的原因

出0入0汤圆

发表于 2018-1-7 07:40:11 来自手机 | 显示全部楼层
这个完整资料在哪里?

出0入0汤圆

发表于 2018-1-7 10:18:44 | 显示全部楼层
dog 发表于 2017-11-17 18:23
它是这个特性,我也是因此放弃了它,现在自己写了一个ROMFS,自己写了工具打包成ROM文件,然后自己写了一 ...

已经放弃了spiffs?yaffs 或者littlefs用过没有?

出0入0汤圆

 楼主| 发表于 2018-3-30 11:37:17 | 显示全部楼层
fcmer2016 发表于 2018-1-7 10:18
已经放弃了spiffs?yaffs 或者littlefs用过没有?

没有,现在自己写的一个简单的,很稳定

出0入0汤圆

发表于 2019-7-24 14:48:45 | 显示全部楼层
dog 发表于 2018-3-30 11:37
没有,现在自己写的一个简单的,很稳定

你的简单稳定版本能学习一下?
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-4-27 10:01

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表