Skip to content
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

Write to a file on SPIFFS esp32 file system. #522

Closed
byfarm opened this issue Nov 26, 2024 · 1 comment
Closed

Write to a file on SPIFFS esp32 file system. #522

byfarm opened this issue Nov 26, 2024 · 1 comment

Comments

@byfarm
Copy link

byfarm commented Nov 26, 2024

Hello,

I was looking around the documentation and I am having trouble finding how to use the SPIFFS file system on the esp32. Looking at espressif's documentation here, it looks to be possible to read and write to a file. However, as I am poling around the rust project's website I can find a few functions that look like they could do this functionality, but no documentation on how to implement it.

The project I am writing is so that a client can send a message to a server running on an esp32, and the server to store the information. The client can then request to receive the messages it wrote to the server. So far I can send messages to the server, but the server cannot store the information. I was thinking that the server could write the message to a file, and then it can access the information when it needs to.

I am a rust newbie so any help would be appreciated. Thank you!

@ivmarkov
Copy link
Collaborator

ivmarkov commented Nov 26, 2024

1 - Use this example as a starting point: https://github.com/esp-rs/esp-idf-svc/blob/master/examples/sd_mmc.rs ; note that it uses FatFS; I would not recommend using Spiffs anyway
2 - Use esp-idf-svc and the other esp-idf-* crates from master rather than the released ones (as this feature is rather new) by using the patch.crates-io syntax that you can read about in the Cargo book; and enable the experimental feature on the svc crate to see these APIs
3 - Best to ask questions in the esp-rs Matrix chat rather than opening bugs asking for help here, as addressing those is very time consuming :)

BTW: If you plan to use the internal flash storage of the esp32 rather than an external SD cartd, the API would be slightly different, and you need to deal with ESP IDF partitions, updating the partition table and so on.

@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants