"SPIFFS: mount failed" after flashing firmware using USB DFU [IDF-4820]

marclee
Posts: 51
Joined: Fri Apr 09, 2021 1:09 pm

"SPIFFS: mount failed" after flashing firmware using USB DFU [IDF-4820]

Postby marclee » Fri Mar 18, 2022 9:42 pm

Configuration:
* ESP32-S2-WROVER (4MB) with ESP-IDF V5.0
* ESP32 is erased completely using "idf.py erase_flash"

If ESP32 gets flashed using flash tool "idf.py flash", firmware runs fine.
If ESP32 gets flashed using USB DFU "idf.py dfu dfu-flash" SPIFFS partition seems to be missing.

E (488) SPIFFS: mount failed, -10025

My partition table.
  1. # Name,     Type,   SubType,    Offset, Size,   Flags
  2. # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
  3. nvs,        data,   nvs,        ,   0x006000,
  4. otadata,    data,   ota,        ,   0x002000,
  5. phy_init,   data,   phy,        ,   0x001000,
  6. ota_0,      app,    ota_0,      ,   0x140000,
  7. ota_1,      app,    ota_1,      ,   0x140000,
  8. storage,    data,   spiffs,     ,   0x160000,

dfu.bin seems to contain all partitions.

Does anybody have an idea what could be wrong?

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: "SPIFFS: mount failed" after flashing firmware using USB DFU

Postby ESP_Sprite » Mon Mar 21, 2022 1:37 am

Any chance you can share your dfu.bin? If not, can you rename that file to dfu.cpio and open it (should be similar to a zipfile) and post what files it contains?

marclee
Posts: 51
Joined: Fri Apr 09, 2021 1:09 pm

Re: "SPIFFS: mount failed" after flashing firmware using USB DFU

Postby marclee » Tue Mar 22, 2022 10:18 pm

  1. -rw-r--r--   0 root     root        21824 Jan  1  1970 bootloader.bin
  2. -rw-r--r--   0 root     root         3072 Jan  1  1970 partition-table.bin
  3. -rw-r--r--   0 root     root         8192 Jan  1  1970 ota_data_initial.bin
  4. -rw-r--r--   0 root     root       524288 Jan  1  1970 project_7899.bin
  5. -rw-r--r--   0 root     root       524288 Jan  1  1970 project_7899.bin.1
  6. -rw-r--r--   0 root     root        21632 Jan  1  1970 project_7899.bin.2
  7. -rw-r--r--   0 root     root       524288 Jan  1  1970 storage.bin
  8. -rw-r--r--   0 root     root       524288 Jan  1  1970 storage.bin.1
  9. -rw-r--r--   0 root     root       393216 Jan  1  1970 storage.bin.2

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: "SPIFFS: mount failed" after flashing firmware using USB DFU

Postby ESP_Sprite » Wed Mar 23, 2022 1:52 am

That's odd, the storage partition data certainly seems to be in there. Can you use esptool or something to check what actually is at the storage SPI flash partition offset after the DFU flash?

marclee
Posts: 51
Joined: Fri Apr 09, 2021 1:09 pm

Re: "SPIFFS: mount failed" after flashing firmware using USB DFU

Postby marclee » Wed Mar 23, 2022 4:45 pm

esptool.py read_flash 0x2A0000 0x160000 storage_copy.bin

--> storage_copy.bin only contains 0xFF.

esptool.py write_flash 0x2A0000 build/storage.bin

--> SPIFFS can be mounted

But it should work using dfu-flash.

How can I generate dfu.bin manually?

marclee
Posts: 51
Joined: Fri Apr 09, 2021 1:09 pm

Re: "SPIFFS: mount failed" after flashing firmware using USB DFU

Postby marclee » Wed Mar 23, 2022 9:17 pm

Meanwhile I could figure out that this problem only occurs if flash size exceeds 2 MB (0x200000).
Is there a limit for flash size using DFU update?

  1. # Name,         Type,   SubType,        Offset, Size,   Flags
  2. # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
  3. nvs,            data,   nvs,            ,       0x006000,
  4. phy_init,       data,   phy,            ,       0x001000,
  5. factory,        app,    factory,        ,       0x110000,
  6. storage,        data,   spiffs,         ,       0x0E0000,

This partition table works. If you increase one of it's partitions, SPIFFS won't be flashed using DFU update.

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: "SPIFFS: mount failed" after flashing firmware using USB DFU

Postby ESP_Sprite » Thu Mar 24, 2022 1:30 am

Ooh, that is a very good catch, that points in the direction of perhaps the ROM subsystem not being configured correctly for the flash available. I'll look into this; I'm decently sure this is a bug in our DFU builder or ROM assumptions.

User avatar
ESP_Roland
Posts: 237
Joined: Tue Oct 09, 2018 10:28 am

Re: "SPIFFS: mount failed" after flashing firmware using USB DFU [IDF-4820]

Postby ESP_Roland » Thu Mar 24, 2022 8:33 am

We will take a look at this issue soon and try to solve it quickly. I'll post here updates about the progress.

marclee
Posts: 51
Joined: Fri Apr 09, 2021 1:09 pm

Re: "SPIFFS: mount failed" after flashing firmware using USB DFU [IDF-4820]

Postby marclee » Sat Apr 02, 2022 8:53 pm

Is there any news?

User avatar
ESP_Roland
Posts: 237
Joined: Tue Oct 09, 2018 10:28 am

Re: "SPIFFS: mount failed" after flashing firmware using USB DFU [IDF-4820]

Postby ESP_Roland » Fri May 27, 2022 7:24 pm

The fix has been accepted and will be published on Github soon. For reference, d2c918f4072f98b1f195bc2d29ee3a99a35d6925 is the commit SHA. It will be included in v5.0.

Who is online

Users browsing this forum: AdsBot [Google], Google [Bot] and 113 guests