esp8266 / esp8266/Arduino

Problem with FileSystem image (littlefs,bin) upload

Open
#8,840 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

#### Platform

- Hardware: [ESP-12|
- Core Version: [latest git hash or date]
- Development Env: Arduino
- Operating System: Windows

- Module: Generic ESP8266 Module
- Flash Size: 4MB

### Problem Description
I have problew with ESP8266 (ESP12) when I try to upload littlefs.bin to the ESP8266 (Littlefs) not spiffs) by my HTTPUpload. Always I get updateError, But I have no problewm with ESP32 using SPIFFS.
```cpp
void update_file() {
//https://github.com/dx4m/Xbox-EEPROM-Utility/blob/master/xbox_eeprom_utility/xbox_eeprom_utility.ino
HTTPUpload &upload = server.upload();
if (upload.status == UPLOAD_FILE_START) {
String updatefile = upload.filename;
Serial.println("Update started:");
if (updatefile.endsWith("littlefs.bin")) {
#ifdef ESP32
if (!Update.begin(UPDATE_SIZE_UNKNOWN, U_SPIFFS)) {
Serial.println("error");
updateError = true;
}
#else
String fsBlockSizeStr = String((int)&_FS_block);
if(updatefile.indexOf(fsBlockSizeStr) < 0){
Serial.printf("Update Error! Please download and install xeu.%s.littlefs.bin\n", fsBlockSizeStr.c_str());
updateError = true;
return;
}
size_t fsSize = ((size_t) &_FS_end - (size_t) &_FS_start);
close_all_fs();
if (!Update.begin(fsSize, U_FS)) {
Serial.println("error");
updateError = true;
}
#endif
}
else {
#ifdef ESP32
if(updatefile.endsWith("esp32.bin")){
Serial.printf("Trying to flash %s\n", updatefile.c_str());
}
else{
Serial.println(F("Error. Please flash any firmware. Make sure you use the right one."));
updateError = true;
return;
}
#else
if((updatefile.endsWith("firmware.bin")) || (updatefile.endsWith("1M.bin")) || (updatefile.endsWith("2M.bin")) || (updatefile.endsWith("4M.bin")) || (updatefile.endsWith("8M.bin"))){
Serial.printf("Trying to flash %s\n", updatefile.c_str());
}
else{
Serial.println(F("Error. Please flash any firmware.bin to xeu.board.8M.bin. Make sure you use the right one."));
Serial.println(F("When you don't know which one, flash any 1M binary."));
updateError = true;
return;
}
#endif
unsigned int maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
if (!Update.begin(maxSketchSpace, U_FLASH)) {
Serial.println("error");
updateError = true;
}
}
}
else if (upload.status == UPLOAD_FILE_WRITE && updateError == false) {
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
Serial.println("upload error");
updateError = true;
}
else {
Serial.print(".");
}
}
else if (upload.status = UPLOAD_FILE_END) {
if (Update.end(true)) {
Serial.println(" Flashing successfully");
Serial.println("Rebooting now");
delay(500);
#ifdef ESP32
ESP.restart();
#else
ESP.reset();
#endif
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.