Open vvzvlad opened 4 years ago
@vvzvlad I faced something like that. The solution is in you compile flags for mkspiffs. I wrote a FAQ in my project, where I show a little about that.
https://github.com/nsfilho/E12AIO3/tree/master/tools
look my sdkconfig.defaults about that compiler flags. OK?
@nsfilho You mean the parameter "SPIFFS_ALIGNED_OBJECT_INDEX_TABLES=1"?
Yes, the "SPIFFS_ALIGNED_OBJECT_INDEX_TABLES=1" parameter makes it work:
I (365) example: Initializing SPIFFS
I (378) example: Partition size: total: 37901, used: 502
I (381) example: Reading file
I (388) example: tst.tst poz: '0'
I (394) example: Read from file: 'TST
'
I (400) example: SPIFFS unmounted
Nice! Now, you can close the issue :))
Please @vvzvlad don't forget to close the issue. If we help espressif
in this way, probably the engineers from company can work on real bugs....
I also faced that, and it soluts my trouble, thanks.
Yes, the "SPIFFS_ALIGNED_OBJECT_INDEX_TABLES=1" parameter makes it work:
I (365) example: Initializing SPIFFS I (378) example: Partition size: total: 37901, used: 502 I (381) example: Reading file I (388) example: tst.tst poz: '0' I (394) example: Read from file: 'TST ' I (400) example: SPIFFS unmounted
It is work for me too.
+1, that solved my issue.
Very nice! We need share ideas and things around this community. Because ESP32 is reality, but some of us have a lot of ESP8266 solutions running :)
Sometimes ESP8266-RTOS appears forgeted in face of ESP32. But some hardware as we produce (in my case, for my house automation) is 100% based on this, and I can't change some of them.
Espressif, please you need have a long term support and R&D for your legacy solutions. Because in more 3 or 4 years, ESP32 will old too. What happens at this time? An entirelly eco-systems depends of you.
We, your community is here. We can help, we can participate on that. If you assign a technical leader for this project (from Espressif, what have access to all info) to conduce us, we will help you to maintain this solution.
In my personal case, I depend of this. It is not a question of if I want to contribute, I really need this project alive. :)
Thank you all, NS.
Environment
git rev-parse --short HEAD
to get the commit id.): b74255d0I'm trying to access the data in spiffs from the firmware, which I made with an external program and I can't do it. 1) Create folder and files:
2) Create spiffs image:
I tried creating both programs. Image settings:
Size 458752(448k). Version of mkspiffs - mkspiffs ver. 0.2.3-6-g983970e/SPIFFS ver. 0.3.7-5-gf5e26c4 3) Checking the image:
Both images are unpacked correctly. 4) Upload the image to ESP:
esptool.py --chip esp8266 --port /dev/ttyUSB0 --baud 115200 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x00090000 ./spiffs.bin
I took the address 0x00090000 and the image size (0x00070000=458752=448k) from the bootloader output:
The loader gets it from partitions.csv:
Checking the count: 0x10000(firmware address)+0x80000(firmware size)=0x00090000(start of spiffs), which is the same as the loader data and the address where I download spiffs.bin.
5)SPIFFS in the firmware correctly defines the beginning of the image (I tried to upload the image to a different address and get an error, there is no error at the correct address, so I conclude that the image is of the correct size and uploaded at the correct address):
I use this code to initialize:
The settings in the firmware are as follows:
Comparing the parameters CONFIG_SPIFFS_META_LENGTH, CONFIG_SPIFFS_PAGE_SIZE, CONFIG_SPIFFS_OBJ_NAME_LEN, CONFIG_SPIFFS_USE_MAGIC, CONFIG_SPIFFS_USE_MAGIC_LENGTH I come to the conclusion that they are the same as programs that create the image, that the firmware has. The size of the image is also correct. Consequently, nothing should interfere with reading the files.
6) SPIFFS correctly determines the presence of the file:
I use this code to open the file:
I tried to open a file that didn't exist, and I failed:
I come to the conclusion that SPIFFS defines the file name correctly.
7) However, reading the file ends unsuccessfully.
I use this code to read the file:
This behavior on b74255d0844c14153bd78c15298e0202b93eda0e. If I use ee0c4459d6d083cfb9da1ae39e4064c7e9dbf3cd, the picture is different and garbage is read instead of the file contents:
(Remember, it must be "TST0000")
I don't know what to do.