-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPIFFS problems #24
Comments
OK, so the Not sure if ESP-IDF's implementation can be used, but if it can, |
Insofar as some of the tooling/frameworks are concerned, maybe it'd be possible to consume PlatformIO to manage it, as to avoid committing blobs to VCS... it supports ESP-IDF, but I have not yet tried to use that framework with it. |
The usage of the spiffs in this project pre-dates the availability of the ESP-IDF SPIFFs. An alternate version from elsewhere was used. What we probably want to do is replace any usage of spiffs processing in this project with the now official / formal ESP-IDF SPIFFS functions found in ESP-IDF. |
@nkolban think we can do away with actually needing |
OK, my PR #25 seems to have broken reading. I'll look into this. also I'll disable formatting upon error. even though duktape-esp32 won't be able to read the filesystem, it should be salvageable thru other means. |
When my partitions line had a size 0x180000: |
wtf... the |
that's what I had in there, but I botched the commit. |
this is my
it appears it stats the file fine:
this is the correct size.
|
I think the problem is the spiffs.img generated by mkspiffs is not consistent with the esp-idf spiffs configuration or implementation. I've tried various mkspiffs versions and the tool is intrinsicly flaky. For example no version will succeed in doing a -c of a directory tree into an spiffs.img and then -u that into a directory... which is a basic check for sanity. Meaning if the tool itself is unable to parse its own generated image, what hope will esp-idf have? |
I thought SPIFFS was flat? |
I remember seeing such an assertion somewhere... yeah, here it is: The failure occurs in esp-idf/components/spiffs/spiffs/src/spiffs_nucleus.c the function spiffs_page_data_check returns SPIFFS_ERR_INDEX_REF_LU. |
OK I think the problem is the mkspiffs is just not the matching tool for the espressif/esp-idf source. The fact that we get any life at all is pure luck, it seems. The default behaviour of mounting the spiffs is to format on failure. Then you get a writable flash file system, and you can manually populate its contents. However https://github.com/pellepl/spiffs/#building mentions spiffsimg My application for the esp32 doesn't even require writing to the flash, or the web ide. I just need bluetooth, so I'm moving onto other tasks. Good luck! |
Ok a thought occured to me. Since the spiffs is both read/write and it is designed to be embedded, the purpose of the spiffsimg tool is to just embed spiffs writing into a 'c' tool on the workstation itself (not the target). So building the spiffsimg tool would be just using the esp-idf's copy of spiffs source files with the right glue. I am trying to devise a development setup where I can start to flesh out a javascript application built on top of the duktape-esp32 infrastructure. I can add 'c' glue code as necessary but the bulk needs to be in javascript (I need to pass this off to people who know javascript well but 'c' not so much...). The serialport http machinery to run a single javascript file is useful for simple tests, but not for real development. So might there not be a common solution? It occured to me to leverage the WIFI support. If I had the spiffsimg tool working on my desktop I could have a small program that would deliver a spiffs image file over the network (spiffs network server). On the ESP32 it would have a spiffs network client that talks to the server, and this network spiffs filesystem could be mounted somewhere (like /net). A config option in NVS could control this (server IP:PORT). This would avoid all wear and tear on the flash device, would be faster than flash writes, and to test out a new version would just require reboot of the ESP32. Once the filesystem tree is stable the spiffs.img could be written to the ESP32 and NVS config could be switched back to use that over wifi/net |
Here's what I'm not understanding: why do we save the files to both places? @nkolban explains in the docs why there are two filesystems:
It would seem to me that we should favor ESPFS for the "built in" files. I'm not sure why we put the files in both places. What if, when we want a file via the web server, it first looks in SPIFFS, and if that fails, it tries to load the file from ESPFS? Then we wouldn't need to duplicate the files, and users can override behavior. Dunno--just an idea. I can't presently verify that my code actually works, assuming the filesystem has been formatted properly, because I'm unsure how to push files to SPIFFS otherwise. May be able to leverage the websocket server? I like @dashxdr's idea too. @dashxdr Are you sure it's the image that's the problem, and not my code? (assuming a correct partition setup) |
@dashxdr I fixed it. PR incoming. |
NK goes into details here: |
Still not working for me. I did get the most recent esp-idf and made your sdkconfig tweaks esp-idf commit hash a5eb369126e5cef31715d2755931cf933bb98bee |
Ok found it. |
this can be closed for now I believe. |
I can use
mkspiffs
to build the SPIFFS filesystem image.esptool
can flash it. In other words,make flashdata
is successful, AFAICT.However, upon mount, SPIFFS doesn't recognize the filesystem; it raises
SPIFFS_ERR_NOT_A_FS
:I'm wondering if this could be a mismatch between the
mkspiffs
version and the SPIFFS version. Mymkspiffs
is v0.2.0; I have no idea what version is used incomponents/spiffs/
. I know there are some backwards-compat concerns with SPIFFS.I may be able to work around this by modifying
duktape_spiffs.c
to reformat, but that would necessarily remove all of the files in the image, and I'd have to upload them again manually (I think). Otherwise, I'll try to update thespiffs
component, in case it's old.The text was updated successfully, but these errors were encountered: