Comments (2)
I did a test that demonstrates the problem and attached some files to show the issue. The zip file has 2 files: fs-bad.bin and fs-good.bin. fs-bad.bin was created by mkspiffs. fs-good.bin was created by the spiffs code in the sketch below.
#include "FS.h"
void read_file()
{
File configFile = SPIFFS.open("/test.txt", "r");
if (!configFile)
{
Serial.println("cannot open file");
}
else
{
size_t configSize = configFile.size();
char buf[512];
memset(buf, 0, 512);
size_t bytes_read = configFile.readBytes(buf, configSize);
configFile.close();
Serial.print("BYTES_READ: ["); Serial.print(bytes_read); Serial.println("]");
Serial.print("DATA: ["); Serial.print(buf); Serial.println("]");
}
}
void write_file()
{
char buf[512];
SPIFFS.format();
strcpy(buf, "*** ==> test data <== ****");
File f = SPIFFS.open("/test.txt", "w");
f.write((const uint8_t)buf, strlen(buf));
f.close();
Serial.println("filesystem created");
}
void setup()
{
Serial.begin(115200);
//Serial.setDebugOutput(true);
delay(5000);
SPIFFS.begin();
String str = "";
Serial.println("FILES:");
Dir dir = SPIFFS.openDir("/");
while (dir.next())
{
str += dir.fileName();
str += " : ";
str += dir.fileSize();
str += "\r\n";
}
Serial.print(str);
write_file();
read_file();
}
void loop()
{
}
from mkspiffs.
I resolved this. I built with SPIFFS_USE_MAGIC_LENGTH=0 and SPIFFS_ALIGNED_OBJECT_INDEX_TABLES=1 and it now works.
from mkspiffs.
Related Issues (20)
- mkspiffs make dist error message: cant find spiffs.h plus solution HOT 1
- Corrupt/unusable image created without "-b" option HOT 1
- SPIFFS_write error(-10001): File system is full. HOT 3
- mkspiffs fails with wear levelling V2 HOT 1
- File exclusion in mkspiffs HOT 1
- Field Updatable SPIFFS HOT 1
- SPIFFS created files with leading / -- can this be avoided with additional parameter?
- ESP8266 can successfully mount spiffs and open the files that spiffs updates, but the read file fails, possix read() returns -1 HOT 1
- SPIFFS_write error(-10001): File system is full
- mkspiffs tool does not unpack image files ... HOT 2
- Windows build error HOT 1
- Compatibility with esp-open-rtos mkspiffs
- aarch64 HOT 1
- A fatal error occurred: Timed out waiting for packet header HOT 2
- Am I using mkspiffs correctly ? HOT 1
- Unable to unpack image created by spiffsgen HOT 3
- When a file is 0 bytes on the disk, an empty file gets uploaded
- Little project request.
- Make fails on M1 pro Mac book Pro HOT 3
- SPIFFS image created does not work in esp32
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mkspiffs.