Unable to use the "official" SPIFFS wrapper

kurtzweber
Posts: 64
Joined: Tue Jan 10, 2017 1:09 pm

Unable to use the "official" SPIFFS wrapper

Postby kurtzweber » Fri Dec 15, 2017 12:47 pm

Hi!

I'm trying to use the official SPIFFS wrapper included in the latest framework but my program doesn't work... In the past I used the loboris implementation without any problems.

My source folder contains only one file (readme.txt) with a line in it:

Image

First I prepared the image using the latest mkspiffs by igrr, https://github.com/igrr/mkspiffs - the image is attached to this post (renamed to .txt):

Code: Select all

./mkspiffs.exe -c ../spiffs_content/ -b 4096 -p 256 -s 0x100000 ../spiffs_content.bin
then I uploaded the image to the flash memory of my devboard:

Code: Select all

python $IDF_PATH/components/esptool_py/esptool/esptool.py --chip esp32 --port COM12 --baud 115200 write_flash -z 0x180000 ../spiffs_content.bin
The custom partition table for my program is:

Image

In my program I only mount the partition, check if the file exists and - if so - try to print its content.
Everything works fine, but when I try to read the file content, I always get EOF.

The source code of the program is attached, when I run it the partition table seems correct:

Image

and it can mount the partition and find the file:

Image

Thanks!
Attachments
spiffs_example_main.c
(1.9 KiB) Downloaded 1095 times
spiffs_content.txt
(1 MiB) Downloaded 1078 times

kurtzweber
Posts: 64
Joined: Tue Jan 10, 2017 1:09 pm

Re: Unable to use the "official" SPIFFS wrapper

Postby kurtzweber » Mon Dec 18, 2017 8:39 am

Hi

during the weekend I reworked the program to use the spiffs hal from loboris and everything works fine... I had to use its version of mkspiffs too... this evening I'll post the modified program... so it seems the official wrapper doesn't work for me, anyone was able to use it successfully?

thanks!

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Unable to use the "official" SPIFFS wrapper

Postby loboris » Mon Dec 18, 2017 4:19 pm

The "official" SPIFFS driver actually works very well.
Some changes are needed to make mkspiffs work with latest esp-idf spiffs changes (meta data & mtime support).

I've prepared the example application with modified mkspiffs, it will be pushed to GitHub probably tomorrow.

kurtzweber
Posts: 64
Joined: Tue Jan 10, 2017 1:09 pm

Re: Unable to use the "official" SPIFFS wrapper

Postby kurtzweber » Tue Dec 19, 2017 9:06 am

Hi loboris,

first of all thanks a lot for your work: with your code I was able to complete my project!
It sounds strange to me that Espressif included a SPIFFS wrapper in its IDF 3.0 but at the moment there's no mkspiffs compatible...

for Espressif guys: my suggestion is to include also the mkspiffs tool in the official framework, to have a "certified" version we can use

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Unable to use the "official" SPIFFS wrapper

Postby loboris » Tue Dec 19, 2017 9:47 am

The (small?) problem with mkspiffs is that many spiffs settings are configurable via menuconfig and mkspiffs build process has to use sdkconfig.h to make the spiffs image with correct settings. The mkspiffs has to be rebuild whenever the configuration changes, and there is no easy way to do it automaticaly.
With changes I've made, you have to manually copy the sdkconfig.h to the mkspiffs build directory (include subdirectory), then rebuild with make, taking care that the correct OS build tools are used, not the ones from xtensa-esp32-elf.
You can get the modified mkspiffs here.

I don't think mkspiffs will ever be included in esp-idf. It's just a tool which is not necessary for spiffs driver to function.

Pravin
Posts: 1
Joined: Sat Feb 10, 2018 6:03 am

Re: Unable to use the "official" SPIFFS wrapper

Postby Pravin » Mon Feb 12, 2018 10:26 am

Hi Loboris,

I am also facing the similar problem. Your ESP32_TFT_library program works for me successfully but I am facing similar problem as Kurtzweber that ESP32 mkspiffs not working as expected.

If I use ESP32 SPIFFS & mkspiffs then I am able to see correct file size but not able to read the file.
Does others face the similar problem ?
If someone is successful, can we give the correct steps i.e partition table, commands used mkspiffs, esptool.py

Thanks & Regards,
PraviN

User avatar
bdelarre
Posts: 11
Joined: Sun Oct 22, 2017 2:15 am

Re: Unable to use the "official" SPIFFS wrapper

Postby bdelarre » Sun Feb 18, 2018 12:31 am

I'm also seeing the same issue with current mkspiffs at revision 1693a95 and release/v3.0 of esp-idf. Can mount the filesystem, can open the file, but every read results in 0 bytes and EOF state.

User avatar
bdelarre
Posts: 11
Joined: Sun Oct 22, 2017 2:15 am

Re: Unable to use the "official" SPIFFS wrapper

Postby bdelarre » Sun Feb 18, 2018 12:42 am

Ignore me, having one of those days...

Seems this is working fine on revisions as described above, the thing that threw me is that the base path used when initializing the spiffs mount, in my case /spiffs seems to count towards the maximum name length defined by SPIFFS_OBJ_NAME_LEN. I had a path which was exactly 32 characters once you included the base path.

Shortening my path names seems to have fixed it.

Who is online

Users browsing this forum: No registered users and 101 guests