PlatformIO Community

SPIFFS Data to ESP8266


#1

How to Upload Data to SPIFFS on esp8266 using platformio.

I am using this procedure:

  1. Create data folder under src folder
  2. put index.html in data folder
  3. run command upload File System image.

It results with:


PlatformManager: Installing espressif8266
Downloading [####################################] 100%
Unpacking [####################################] 100%
espressif8266 @ 2.0.4 has been successfully installed!
The platform ‘espressif8266’ has been successfully installed!
The rest of packages will be installed automatically depending on your build environment.
Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz 80KB RAM (4MB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 29 compatible libraries
Scanning dependencies…
Dependency Graph
|-- 1.3.4
| |-- 1.0.2
|-- 1.0.2
|-- 1.0
| |-- 1.0
|-- 2.1.3
| |-- 1.0
| |-- 1.0
| |-- <Ethernet(esp8266)> 1.0.4
| | |-- 1.0
| |-- 1.0
|-- 1.0
|-- 1.0
Building SPIFFS image from ‘data’ directory to .pioenvs\nodemcuv2\spiffs.bin
warning: can’t read source directory
*** [.pioenvs\nodemcuv2\spiffs.bin] Error 1
======================================================================================================== [ERROR] Took 1.83 seconds ========================================================================================================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

Executing task: C:\Users\Ivan.platformio\penv\Scripts\platformio.exe run --target uploadfs <

Processing nodemcuv2 (platform: espressif8266; board: nodemcuv2; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz 80KB RAM (4MB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 29 compatible libraries
Scanning dependencies…
Dependency Graph
|-- 1.3.4
| |-- 1.0.2
|-- 1.0.2
|-- 1.0
|-- 1.0
|-- 2.1.3
| |-- 1.0
| |-- 1.0
| |-- 1.0
| |-- <Ethernet(esp8266)> 1.0.4
| | |-- 1.0
|-- 1.0
| |-- 1.0
Building SPIFFS image from ‘data’ directory to .pioenvs\nodemcuv2\spiffs.bin
warning: can’t read source directory
*** [.pioenvs\nodemcuv2\spiffs.bin] Error 1

My platformio.ini:

[env:nodemcuv2]

platform = espressif8266

board = nodemcuv2

framework = arduino


#2

Nope data/ folder must be at the same level at src/, not under it.

Refer https://docs.platformio.org/en/latest/platforms/espressif8266.html#uploading-files-to-file-system-spiffs


#3

As Max said, it doesn’t go under src… it goes at the same level as src. Here is an example from one of my workspaces…

image


#4

Tnx, saw some projects that put the data inside source, so it missleaded me.
Solved! :slight_smile:


#5

Then they must have also reconfigured the data_dir = .. option in the platformio.ini. (refer https://docs.platformio.org/en/latest/projectconf/section_platformio.html#projectconf-pio-data-dir)