Skip to content

fix: respect declared SPIFFS partition size when between default and threshold#350

Open
QQSHI13 wants to merge 1 commit into
bmorcelli:mainfrom
QQSHI13:fix/spiffs-size-threshold
Open

fix: respect declared SPIFFS partition size when between default and threshold#350
QQSHI13 wants to merge 1 commit into
bmorcelli:mainfrom
QQSHI13:fix/spiffs-size-threshold

Conversation

@QQSHI13

@QQSHI13 QQSHI13 commented Jun 21, 2026

Copy link
Copy Markdown

When installing firmware with a data (SPIFFS) partition whose declared size falls between LAUNCHER_DEFAULT_SPIFFS_SIZE and LAUNCHER_DEFAULT_SPIFFS_THRESHOLD (5MB), the launcher was falling back to the default size (e.g. 448KB on 8MB flash) instead of using the firmware´s declared partition size.

For example, xiaozhi-esp32´s v2/8m.csv declares a 2MB assets partition. Since 2MB < 5MB, the launcher created only 448KB, truncating the 1.5MB of assets data and causing checksum failures at boot.

Changes:

  • sd_functions.cpp, onlineLauncher.cpp, webInterface.cpp (×2): Replace the binary threshold check with a three-tier logic:
    • > threshold → use remaining free space (unchanged)
    • > default → use the declared partition size
    • ≤ default → use the default size (fallback)

This ensures firmware with moderately-sized data partitions get their full declared allocation.

@Huzzla101

Huzzla101 commented Jun 21, 2026 via email

Copy link
Copy Markdown

@bmorcelli

Copy link
Copy Markdown
Owner

99% of the firmwares don't bring any information on Spiffs partition, it usually is used to save firmware configuration.. that is the reason for such a small partition

Adding this rule of bringing the full sized spiffs partition will lead to the impossibility of installing more than one firmware into the device, because spiffs is usually over dimensioned..

For example, Bruce declares 3Mb for spiffs, but don't use it all if there's a SD card installed

Nemo declares a 3Mb spiffs partition, but don't use it at all

Many others do the same and don't use..

I'd prefere using exception in this case, like what is done with FAT partitions named "sys" and "system", that will carry the partition size from firmware partition table.. and do the same if the spiffs partition is labeled "assets".. if other firmware shows up with this same problem, we add this new exception into Launcher.. so it doesn't break the other Launcher features (multi fw installing)

The previous approach applied a general three-tier size selection to
all SPIFFS partitions, which could break multi-firmware installation
since most firmwares over-declare their SPIFFS size.

Per maintainer feedback, this uses a targeted exception: only
partitions labeled "assets" (like xiaozhi-esp32) get the full
declared size. All other SPIFFS partitions keep the original
threshold-based behavior.

This mirrors the existing pattern for FAT partitions labeled
"sys"/"system", which already receive special treatment.
@QQSHI13 QQSHI13 force-pushed the fix/spiffs-size-threshold branch from 4b3327c to 35fd16a Compare June 22, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants