- Mon Aug 10, 2015 12:50 pm
#25547
Hi IGRR,
since you are there, I couldn't make the upload successful yet.
I see in mkspiffs that defaults for PageSize=256 and BlockSize=4096.
When I upload this image into my ESP, it looks corrupted and been reformatted.
I've added traces in the SPIFFS.begin(), and it looks like those parameters are different, explaining probably the previous behavior. the trace shows :
Code: Select allSPIFFSImpl: allocating 512+180+1400=2092 bytes
SPIFFSImpl: mounting fs @6b000, size=4000, block=1000, page=100
SPIFFSImpl: mount rc=0
The problem is I didn't find yet where the default "size=4000, block=1000" are coming from.
Could you give me hint ?
Is it normal that defaults are not the same in ESP code and mkspiffs tools, that would be easier ?
EDIT : Shame on me, the traces are in HEX not Decimal ...
So, the settings are matching ! But still, why the SPIFFS been reformatted ?
Here the trace just after the upload, first mount failed, then reformat, than second mount succeed ...
Code: Select allSPIFFSImpl: allocating 512+180+1400=2092 bytes
SPIFFSImpl: mounting fs @6b000, size=4000, block=1000, page=100
SPIFFSImpl: mount rc=-1
SPIFFSImpl: mounting fs @6b000, size=4000, block=1000, page=100
SPIFFSImpl: mount rc=0
EDIT2: Just got it !!!
in mkspiffs github, the spiffs_config.h has the following define set to 0, which probably means "unformatted", by changing it to 1, it works ! ... (I will submit that to IGGR when I get a chance, after my pending PRs)
Now I get my uploaded SPIFFS showing correctly :
Code: Select allSPIFFSImpl: allocating 512+180+1400=2092 bytes
SPIFFSImpl: mounting fs @6b000, size=4000, block=1000, page=100
SPIFFSImpl: mount rc=0
/metalic.png - 1405
/Tourlou.txt - 1428
/README.md - 1428
EDIT3: I should not clame victory too soon !
Having added some images, I got probably corrupted SPIFFS image, because it is showing only 2 files :
Code: Select allSPIFFSImpl: allocating 512+180+1400=2092 bytes
SPIFFSImpl: mounting fs @6b000, size=4000, block=1000, page=100
SPIFFSImpl: mount rc=0
/green_led.jpg - 2023
/gray_led.jpg - 5344
But my folder is :
Code: Select all-rw-rw-r-- 1 martin martin 5344 Aug 10 15:32 gray_led.jpg
-rw-rw-r-- 1 martin martin 2023 Aug 10 15:32 green_led.jpg
-rwxrwxr-x 1 martin martin 1405 Aug 10 15:32 metalic.png*
-rw-rw-r-- 1 martin martin 1428 Aug 9 22:44 README.md
-rw-rw-r-- 1 martin martin 1917 Aug 10 15:32 red_led.jpg
-rw-rw-r-- 1 martin martin 1428 Aug 9 22:44 Tourlou.txt
-rw-rw-r-- 1 martin martin 2071 Aug 10 15:32 yellow_led.jpg
Searching on the net, I see that Peter Andersson (pellepl) have done some changes in spiffs github, maybe IGRR didn't get chance to grab those ...
EDIT4:
BTW, another relevant thing I've face during this investigation :
Trying to upload my spiffs image with "esptool.py", it is somehow corrupt my already installed firmware, but the same upload using IGRR's esptool does not. (after the upload, I wasn't able to connect to Wifi without a crash, even after clearing the Wifi settings using blink.bin, I had to re-upload my firmware ...
)
Code: Select allesptool.py --port /dev/ttyUSB0 write_flash 0x6B000 myspiffs.bin
Code: Select allesptool -vv -cd ck -cb 115200 -cp /dev/ttyUSB0 -ca 0x6B000 -cf myspiffs.bin
EDIT5:
Oh !!! some interesting finding ! the bug mentioned above when I've added files, looking at the file list, I saw that one file was bigger then 4096 bytes, I've delete it, redo the image, upload and Bingo
, all other files were there. So, there is a bug with files bigger than 4096 bytes !