-
Notifications
You must be signed in to change notification settings - Fork 13.3k
mkspiffs partition seems to be ReadOnly when mounted into an ESP #733
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
Comments
I tried a few ways, but it seems I can't reproduce this issue. Here's what I do:
mkdir -p data
echo "hello" > data/data.txt
./mkspiffs -b 0x1000 -p 0x100 -s 0x10000 -c data fs.bin
#include "FS.h"
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
for (int i = 0; i < 5; ++i) {delay(1000); Serial.print(".");} // give me some time to open terminal window
Serial.println("");
SPIFFS.begin();
const char* fname = "/data.txt";
{
File f = SPIFFS.open(fname, "a");
if (!f) {
Serial.printf("%s doesn't exist\r\n", fname);
return;
}
Serial.printf("Opened %s\r\n", fname);
Serial.printf("Size: %d\r\n", f.size());
Serial.println("adding more data");
f.println("more data");
}
{
File f = SPIFFS.open(fname, "r");
Serial.printf("Size: %d\r\n", f.size());
}
}
void loop() { }
esptool-ck -cp /dev/tty.usbserial -cb 921600 -ca 0x6b000 -cf fs.bin Here is what i get (with debug output enabled just in case):
So the initial file size was correct and we have added some more data there successfully. Edit: mkspiffs arguments listed above correspond to "Generic ESP8266 512k/64k" option in the IDE. |
Hi IGRR, Ok, thanks ! So, maybe I should provide here my spiff image which contain more files and bigger ones, which can lead to some confusion. So, in cas it can help to narrow the issue, I'm providing here myspiff.bin image. 0 /ddd/d/d/d/i/dd era_cnt: 0 Here is the image in attachment, it is a ZIP file, although GIF extension is added simply to bypass attachment github limitation : |
Which options did you use to build this image (i.e. something like |
I didn't provide any, so it was using the defaults, so according to main.cpp, it was using -s 0x10000 -p 256 -b 4096. |
Oh, but do these defaults match SPIFFS settings on the ESP side? Which board/flash size setting did you use in the IDE? |
Hi again Ivan, |
After mounting a partition made with mkspiffs, all files are readable, but opening a new file, either in "a" or "w" mode is failing.
Also, trying to open existing one in "a" mode will not fail but the content is never written.
The text was updated successfully, but these errors were encountered: