s00500 / ESPUI

A simple web user interface library for ESP32 and ESP8266

Home Page:https://valencia.lbsfilm.at/midterm-presentation/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bootloop: "assert failed: esp_littlefs_format esp_littlefs.c:275 (partition_label)"

funktionierbar opened this issue · comments

Describe the bug
After I solved the compile issues described in issue 156, my project produced a bootloop. I thought the problem was in my code, but I narrowed it down to a call on ESPUI.prepareFileSystem(); The Example prepareFilesystem provided by the ESPUI-Library produces the same error and behaviour.

To Reproduce
Steps to reproduce the behavior:

Upload the example sketch PrepareFileSystem to my board.

Expected behavior
ESPUI.prepareFileSystem(); not producing errors.

Serial Monitor

Rebooting...
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:12804
ho 0 tail 12 room 4
load:0x40080400,len:3032
entry 0x400805e4

assert failed: esp_littlefs_format esp_littlefs.c:275 (partition_label)

Backtrace:0x40083205:0x3ffb26100x40087b41:0x3ffb2630 0x4008c689:0x3ffb2650 0x400d320b:0x3ffb2780 0x400d6e89:0x3ffb27b0 0x400d174d:0x3ffb27d0 0x400d1482:0x3ffb27f0 0x400d7a4e:0x3ffb2820

ELF file SHA256: 0000000000000000

Rebooting...

Desktop (please complete the following information):
OS: Kubuntu 20.04
ESPUI library 2.1.0
LITTLEFS_esp32 library V1.0.6 by lorol
ESPAsyncWebserver library V1.2.3 by Me-No-Dev
ArduinoJson library V6.19.1 by Benoit Blanchon
AsyncTCP library V 1.1.1 by Me-No-Dev
esp32 board collection by espressif Systems 2.0.2
Arduino IDE 1.8.15
Wemos Lolin D32 Pro Board V2.0

Additional context
Thank you for your tips on where to go from here! I will gladly provide any info you might need.

I looked at the ESPUI library's prepareFileSystem() function and it has an error. It calls LITTLEFS.format() before LITTLEFS.begin(), which is not allowed.

I suggest editing prepareFileSystem() in the Arduino Library ESPUI.cpp; Your Arduino preferences file will tell you the sketch path to the main library folder, edit the ESPUI folder found there. Find the LITTLEFS.format() statement and comment it out. This is not needed since a format will be performed by the LITTLEFS.begin(true) statement that follows it.

I tested the original code and confirmed your problem. I added the recommended patch and the program ran without incident. However, browsing the ESPUI device shows another issue -- all I see is the page header that says "Control Offline." It's late, so I'm going offline. Hopefully someone else can help out.

FWIW, I use Platformio IDE to build ESPUI. It has a filesystem upload feature, so no need to use the prepareFileSystem(). So I've never used that function before, your issue was the first time for me to try it.

  • Thomas

For all my screwing around with this library I have never used LittleFS, I just run it all from PROGMEM. I understand that theoretically LittleFS will save some flash space but it hasn't even been close to being a problem yet so that is one part of the library I've not touched.

More to the saga. It seems that prepareFileSystem() was only writing the files that belong on the root directory. So that's why I only see the "Control Offline" (it is in /index.html). The other seven files are in LITTLEFS's subfolders named /css and /js.

The prepareFileSystem() was written for SPIFFS, which didn't have real subfolders. But LITTLEFS is a "real" storage system and it observes folder hierarchy.

So prepareFileSystem() has to create the subfolders before it can write to them. Here's patch instructions:

  1. Edit ESPUI.cpp in the Arduino Library.
  2. Find the comment:
    // Now write
  3. Below the comment add these two lines:
    LITTLEFS.mkdir("/css");
    LITTLEFS.mkdir("/js");

The patched area will look like this:

    // Now write
    LITTLEFS.mkdir("/css");
    LITTLEFS.mkdir("/js");
    writeFile("/index.htm", HTML_INDEX);

    writeFile("/css/style.css", CSS_STYLE);
    writeFile("/css/normalize.css", CSS_NORMALIZE);

Tested, works.

I understand that theoretically LittleFS will save some flash space but it hasn't even been close to being a problem yet so that is one part of the library I've not touched.

Well if you do decide to play with ESPUI's LITTLEFS option then it would be great if you looked for the reason to the browser refresh crash that only happens when LITTLEFS is used. But honestly, I'd rather you spend your time adding more of your cool features to the UI.

  • Thomas

I can't get it to work, sometimes it there are several files missing, sometimes it's all gone (exept the folders) , but whatever i do, after i flash my normal code back on the esp i can't get it to work. I can't even get it to work out of the progmem?! what am i doing wrong here?, my code is working fine on an esp8266 but the esp32 is driving me crazy.

I can't get it to work, sometimes it there are several files missing, sometimes it's all gone (exept the folders)

It's not clear what kind of ESPUI issue you are experiencing. Perhaps you mean that ESPUI fails to build (ESP32 board) when it is configured to use LITTLEFS. If that is the problem then please rebuild with the "embedded" ESPUI and report back what happens.

BTW, if you're using Platformio to build ESPUI then post any warning/error messages. If you are using the Arduino IDE then I probably won't be able to help (I don't use Arduino).

  • Thomas

i changed the ESPui.ccp according to your fix. now the build acctualy runs trough, and the monitoring output af the filesystem creation looks good. but when I try to run my normal sketch, it get the folloing:

IP address: 192.168.179.150
Listing directory: /
  DIR : /css
Listing directory: /css
  FILE: /css/normalize.css  SIZE: 1945
  FILE: /css/style.css  SIZE: 15650
  FILE: /index.htm  SIZE: 1492
  DIR : /js
Listing directory: /js
  FILE: /js/graph.js  SIZE: 4768
  FILE: /js/slider.js  SIZE: 2897
  FILE: /js/tabbedcontent.js  SIZE: 4464
UI Initialized

But the ui is not getting loaded correctly, like you stated a few comments before ( control offline).

btw im using plattformio. and sofar buildprogress and stuff looks all good. and the programm runs fine on the 8266.

Some data files are missing. Here's what I see on my build:

Listing directory: /
  DIR : /css
Listing directory: /css
  FILE: /css/normalize.css  SIZE: 3873
  FILE: /css/style.css  SIZE: 23106
  FILE: /index.htm  SIZE: 1691
  DIR : /js
Listing directory: /js
  FILE: /js/controls.js  SIZE: 25381
  FILE: /js/graph.js  SIZE: 7883
  FILE: /js/slider.js  SIZE: 3799
  FILE: /js/tabbedcontent.js  SIZE: 10456
  FILE: /js/zepto.min.js  SIZE: 26391
UI Initialized

I suspect that your board_build.partitions is not large enough for all the data files. I suggest you remove some files from the data directory (some are not needed to run the UI).

Remove these from the project (archive them outside the project folder):

    data/index.min.htm
    data/css/normalize.min.css
    data/css/style.min.css
    data/js/controls.min.js
    data/js/graph.min.js
    data/js/slider.min.js
    data/js/tabbedcontent.min.js

Then erase the ESP32 and re-upload the data files and sketch bin.

I don't recognize the file sizes on your output, so you are using a different version. I'm using a pre-release created by @iangray001 that he created on Feb 16 2022. So let's keep that in mind if you continue to have problems.

And just to confirm, does you sketch work if you use the embedded version of ESPUI?

So first of all, thanks for your support. I will for now use the embedded version, which works btw. I guess while using arduinoOTA ( which also needs a lot of space) i'll stick to the embedde version. and debug the LITTLEFS later.

I'm using board_build.partitions = min_spiffs.csv in the platformio.ini file. That will work with OTA and ESPUI, but requires removing those unneeded data files (see above post) from the filesystem. Even with OTA support, the partitions had room in LITTLEFS to store my JSON and image files.

But at this time the embedded solution is better, so that's what I using now. Web pages load faster and the ESP32 is more stable (no annoying random reboots during browser refresh).

  • Thomas