Do I need to make custom partition to be able to upload spiffs.bin?

OS: Linux Mint 19.1
Board: ESP32-EVB
IDE: Platformio IDE on VSCode
Hello !

I am trying to implement Firmware Update via file upload in my project.
I have followed @lbernstone 's example and I made it to work when uploading a firmware.bin file. But when I’m trying to upload spiffs.bin it returns A LOT of Wrong Magic Byte lines.

I get spiffs.bin from pio run -t buildfs.

platform =
board = esp32-evb
framework = arduino
board_build.flash_mode = qio
board_build.f_flash = 80000000L
upload_port = /dev/ttyUSB0
monitor_port = /dev/ttyUSB0
monitor_speed = 115200
upload_speed = 115200
build_flags = -DCORE_DEBUG_LEVEL=5
#extra_scripts = post:scripts/

lib_deps =

Do you think I have to make custom partitions ? And if I have to, how do I do that ? I’ve only found board_build.partitions. But what do I do with it ? What do I write after board_build.partitions= ? How many partitions do I need to make ? Can I only reformat the one for SPIFFS ?

I am beat and I have no idea idea what to do.

Is your code correctly setting the upload mode/target to U_SPIFFS? I see there was a commit to that example which references that very issue… and looking at the underlying Updater library… it looks like UPDATE_ERROR_MAGIC_BYTE error is thrown when the mode is U_FLASH, not U_SPIFFS…

1 Like

The problem actually came from the update implementation. It did not read spiffs file name properly
This is working:

int cmd = (filename.indexOf("spiffs") > -1) ? U_SPIFFS : U_FLASH;

It was > 0 before so even though I gave it a spiffs.bin it couldn’t read it, and it set the mode to U_FLASH while trying to use a spiffs.bin

1 Like