imoon So I’ve been playing with this and thus far my observations are:
- I can write to multiple files and recover their contents:
/lfs mount: 0
/lfs: bsize = 16 ; frsize = 4096 ; blocks = 8192 ; bfree = 8190
/lfs/test0 stat: 0
fn 'test0' siz 22
/lfs/test0 {"test":0,"entry",:0}: 22
/lfs/test0 seek start: 0
/lfs/test0 close: 0
/lfs/test1 stat: 0
fn 'test1' siz 22
/lfs/test1 {"test":1,"entry",:1}: 22
/lfs/test1 seek start: 0
/lfs/test1 close: 0
/lfs/test2 stat: 0
fn 'test2' siz 22
/lfs/test2 {"test":2,"entry",:2}: 22
/lfs/test2 seek start: 0
/lfs/test2 close: 0
/lfs/test3 stat: 0
fn 'test3' siz 22
/lfs/test3 {"test":3,"entry",:3}: 22
/lfs/test3 seek start: 0
/lfs/test3 close: 0
/lfs/test4 stat: 0
fn 'test4' siz 22
/lfs/test4 {"test":4,"entry",:4}: 22
/lfs/test4 seek start: 0
/lfs/test4 close: 0
/lfs/test5 stat: 0
fn 'test5' siz 22
/lfs/test5 {"test":5,"entry",:5}: 22
/lfs/test5 seek start: 0
/lfs/test5 close: 0
/lfs/test6 stat: 0
fn 'test6' siz 22
/lfs/test6 {"test":6,"entry",:6}: 22
/lfs/test6 seek start: 0
/lfs/test6 close: 0
/lfs/test7 stat: 0
fn 'test7' siz 22
/lfs/test7 {"test":7,"entry",:7}: 22
/lfs/test7 seek start: 0
/lfs/test7 close: 0
/lfs/test8 stat: 0
fn 'test8' siz 22
/lfs/test8 {"test":8,"entry",:8}: 22
/lfs/test8 seek start: 0
/lfs/test8 close: 0
/lfs/test9 stat: 0
fn 'test9' siz 22
/lfs/test9 {"test":9,"entry",:9}: 22
/lfs/test9 seek start: 0
/lfs/test9 close: 0
- One thing I did notice was that it failed erasing the volume with a
-19
error. (ENODEV
from errno.h
)
2020-11-22T18:31:09.666Z DEBUG modem << Erasing flash area ... -19
2020-11-22T18:31:09.689Z DEBUG modem << [00:00:00.013,397] [0m<inf> littlefs: LittleFS version 2.2, disk version 2.0[0m
2020-11-22T18:31:09.691Z DEBUG modem << [00:00:00.021,636] [0m<inf> littlefs: FS at W25Q32JV:0x0 is 8192 0x1000-byte blocks with 512 cycle[0m
2020-11-22T18:31:09.693Z DEBUG modem << [00:00:00.030,914] [0m<inf> littlefs: sizes: rd 16 ; pr 16 ; ca 64 ; la 32[0m
2020-11-22T18:31:09.722Z DEBUG modem << [00:00:00.054,199] [0m<inf> littlefs: /lfs mounted[0m
So looking into it, it appears that the CONFIG_PM_EXTERNAL_FLASH_SIZE
should be 0×400000. I had the value in bits which screwed everything up. Now full flash erases ok with no errors. I just pushed the example repository.
2020-11-22T18:41:04.783Z DEBUG modem << *** Booting Zephyr OS build v2.3.0-rc1-ncs3 ***
2020-11-22T18:41:04.785Z DEBUG modem << Area 0 at 0x0 on W25Q32JV for 33554432 bytes
2020-11-22T18:41:05.236Z DEBUG modem << Erasing flash area ... 0
Sorry for the delay on this @imoon
Some other great resources when fiddling with the flash. (Hopefully you don’t have to after this.)