Full example of using spiffs with ESP32

Prasad
Posts: 48
Joined: Sun Jul 23, 2017 5:26 pm

Re: Full example of using spiffs with ESP32

Postby Prasad » Sun Jul 23, 2017 5:37 pm

@loboris, My question might be silly, but i'm having trouble in flashing the SPIFFS image in to my ESP32 and i'm getting below error when executing "make copyfs",

Code: Select all

make: *** No rule to make target `copyfs'.  Stop.
I would be grateful if anyone could tell me what i'm missing here.

Let alone making a new image, i'm even unable to flash the one given by you in the example repository. Also i'm running this on Mac OS X.

loboris wrote:The example source code can be found on GitHub:
https://github.com/loboris/ESP32_spiffs_example

How to build

Configure your esp32 build environment as for other esp-idf examples
Clone the repository

Code: Select all

git clone https://github.com/loboris/ESP32_spiffs_example.git
Execute menuconfig and configure your Serial flash config and other settings. Included sdkconfig.defaults sets some defaults to be used.
Navigate to SPIffs Example Configuration and set SPIFFS options.
Select if you want to use wifi (recommended) to get the time from NTP server and set your WiFi SSID and password.

Code: Select all

make menuconfig
Make and flash the example.

Code: Select all

make all && make flash
Features
  • full implementation of spiffs with VFS
  • directories are supported
  • file timestamp is added to standard spiffs
  • example of list directory functions
  • example of file copy functions
When using file related functions which has filename argument, prefix /spiffs/ has to be added to the file name.

Prepare SPIFFS image

It is not required to prepare the image, as the spiffs will be automatically formated on first use, but it might be convenient.

SFPIFFS image can be prepared on host and flashed to ESP32.
New: Tested and works under Linux, Windows and Mac OS.

Copy the files to be included on spiffs into components/spiffs_image/image/ directory. Subdirectories can also be added.

Execute:

Code: Select all

make makefs
to create spiffs image in build directory without flashing to ESP32

Execute:

Code: Select all

make flashfs
to create spiffs image in *build* directory and flash it to ESP32

Execute:

Code: Select all

make copyfs
to flash prepared components/spiffs_image/spiffs_image.img to ESP32

Example functions
  • get the time from NTP server and set the system time (if WiFi is enabled)
  • register spiffs as VFS file system; if the fs is not formated (1st start) it will be formated and mounted
  • perform some file system tests
    • write text to file
    • read the file back
    • make directory
    • copy file
    • remove file
    • remove directory
    • list files in root directory and subdirectories


Example output

Code: Select all

I (1185) cpu_start: Pro cpu start user code
I (1240) cpu_start: Starting scheduler on PRO CPU.
I (1242) cpu_start: Starting scheduler on APP CPU.
I (1242) [SPIFFS example]: Time is not set yet. Connecting to WiFi and getting time over NTP.
I (1271) wifi: wifi firmware version: 6c86a1c
I (1271) wifi: config NVS flash: enabled
I (1271) wifi: config nano formating: disabled
I (1272) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (1281) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (1313) wifi: Init dynamic tx buffer num: 32
I (1313) wifi: Init dynamic rx buffer num: 32
I (1314) wifi: wifi driver task: 3ffc2324, prio:23, stack:4096
I (1316) wifi: Init static rx buffer num: 16
I (1320) wifi: Init dynamic rx buffer num: 32
I (1324) wifi: Init rx ampdu len mblock:7
I (1328) wifi: Init lldesc rx ampdu entry mblock:4
I (1332) wifi: wifi power manager task: 0x3ffc9cbc prio: 21 stack: 2560
I (1339) [SPIFFS example]: Setting WiFi configuration SSID LoBoInternet...
I (1346) wifi: wifi timer task: 3ffcad44, prio:22, stack:3584
I (1371) phy: phy_version: 350, Mar 22 2017, 15:02:06, 1, 0
I (1371) wifi: mode : sta (24:0a:c4:00:97:c0)
I (1492) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1
I (2150) wifi: state: init -> auth (b0)
I (2152) wifi: state: auth -> assoc (0)
I (2155) wifi: state: assoc -> run (10)
I (2189) wifi: connected with LoBoInternet, channel 1
I (4252) event: ip: 192.168.0.16, mask: 255.255.255.0, gw: 192.168.0.1
I (4252) [SPIFFS example]: Initializing SNTP
I (4253) [SPIFFS example]: Waiting for system time to be set... (1/10)
I (6260) [SPIFFS example]: System time is set.
I (6260) wifi: state: run -> init (0)
I (6260) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1
E (6262) wifi: esp_wifi_connect 816 wifi not start


I (7262) [SPIFFS example]: ==== STARTING SPIFFS TEST ====

I (7262) [SPIFFS]: Registering SPIFFS file system
I (7263) [SPIFFS]: Mounting SPIFFS files ystem
I (7268) [SPIFFS]: Start address: 0x180000; Size 1024 KB
I (7311) [SPIFFS]: Mounted


==== Write to file "/spiffs/test.txt" ====
     361 bytes written

==== Reading from file "/spiffs/test.txt" ====
     361 bytes read [
ESP32 spiffs write to file, line 1
ESP32 spiffs write to file, line 2
ESP32 spiffs write to file, line 3
ESP32 spiffs write to file, line 4
ESP32 spiffs write to file, line 5
ESP32 spiffs write to file, line 6
ESP32 spiffs write to file, line 7
ESP32 spiffs write to file, line 8
ESP32 spiffs write to file, line 9
ESP32 spiffs write to file, line 10

]

==== Reading from file "/spiffs/spiffs.info" ====
     405 bytes read [
INTRODUCTION

Spiffs is a file system intended for SPI NOR flash devices on embedded targets.
Spiffs is designed with following characteristics in mind:

  * Small (embedded) targets, sparse RAM without heap
  * Only big areas of data (blocks) can be erased
  * An erase will reset all bits in block to ones
  * Writing pulls one to zeroes
  * Zeroes can only be pulled to ones by erase
  * Wear leveling

]

LIST of DIR [/spiffs/]
T  Size      Date/Time         Name
-----------------------------------
d         -                    /spiffs
d         -  17/05/2017 13:00  images
f      8532  17/05/2017 13:00  testSpiffs.c
f       405  17/05/2017 13:00  spiffs.info
f       361  17/05/2017 15:05  test.txt
-----------------------------------
       9298 in 3 file(s)
-----------------------------------
SPIFFS: free 772 KB of 957 KB

==== Make new directory "/spiffs/newdir" ====
     Directory created

LIST of DIR [/spiffs/]
T  Size      Date/Time         Name
-----------------------------------
d         -                    /spiffs
d         -  17/05/2017 13:00  images
f      8532  17/05/2017 13:00  testSpiffs.c
f       405  17/05/2017 13:00  spiffs.info
f       361  17/05/2017 15:05  test.txt
d         -  17/05/2017 15:05  newdir
-----------------------------------
       9298 in 3 file(s)
-----------------------------------
SPIFFS: free 772 KB of 957 KB
     Copy file from root to new directory...

LIST of DIR [/spiffs/newdir]
T  Size      Date/Time         Name
-----------------------------------
f       361  17/05/2017 15:05  test.txt.copy
-----------------------------------
        361 in 1 file(s)
-----------------------------------
SPIFFS: free 771 KB of 957 KB
     Removing file from new directory...

LIST of DIR [/spiffs/newdir]
T  Size      Date/Time         Name
-----------------------------------
-----------------------------------
SPIFFS: free 772 KB of 957 KB
     Removing directory...

LIST of DIR [/spiffs/]
T  Size      Date/Time         Name
-----------------------------------
d         -                    /spiffs
d         -  17/05/2017 13:00  images
f      8532  17/05/2017 13:00  testSpiffs.c
f       405  17/05/2017 13:00  spiffs.info
f       361  17/05/2017 15:05  test.txt
-----------------------------------
       9298 in 3 file(s)
-----------------------------------
SPIFFS: free 772 KB of 957 KB

==== List content of the directory "images" ====

LIST of DIR [/spiffs/images]
T  Size      Date/Time         Name
-----------------------------------
f     39310  17/05/2017 13:00  test1.jpg
f     50538  17/05/2017 13:00  test2.jpg
f     38460  17/05/2017 13:00  test3.jpg
f     47438  17/05/2017 13:00  test4.jpg
-----------------------------------
     175746 in 4 file(s)
-----------------------------------
SPIFFS: free 772 KB of 957 KB


User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Full example of using spiffs with ESP32

Postby loboris » Sun Jul 23, 2017 10:51 pm

There were some changes in latest esp-idf which prevented make makefs|flashfs|copyfs to be executed.

The repository is updated with necessary fixes and it works now. Please, pull the changes.

Prasad
Posts: 48
Joined: Sun Jul 23, 2017 5:26 pm

Re: Full example of using spiffs with ESP32

Postby Prasad » Mon Jul 24, 2017 3:28 am

Awesome, It works now. Thanks.

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Full example of using spiffs with ESP32

Postby loboris » Sun Aug 13, 2017 12:52 pm

Update:
  • SPIFFS LOCK/UNLOCK (mutex) added to make spiffs operations thread safe
  • MultiTask test added to example application
If you are using spiffs in some other projects, please copy spiffs directory from this repository to your project.
Only the files spiffs_vfs.c and spiffs_config.h are changed.

nickux
Posts: 3
Joined: Wed Aug 09, 2017 6:21 am

Re: Full example of using spiffs with ESP32

Postby nickux » Mon Aug 14, 2017 9:14 am

loboris wrote: If you are using spiffs in some other projects, please copy spiffs directory from this repository to your project.
Only the files spiffs_vfs.c and spiffs_config.h are changed.
Thank you for your work! As a new to ESP32 your repositories have helped me a lot.

Trialblazer47
Posts: 60
Joined: Mon Jun 26, 2017 5:36 am

Re: Full example of using spiffs with ESP32

Postby Trialblazer47 » Fri Aug 25, 2017 9:00 am

Hi I have some issue compiling this library...
I posted it as issue on the git.. https://github.com/loboris/ESP32_spiffs ... e/issues/5

Can someone tell me whats the problem ?

this is what happens on compiling .

Code: Select all

...
AR libmdns.a
CC micro-ecc/uECC.o
AR libmicro-ecc.a
AR libmkspiffs.a
usage: mkdir [-pv] [-m mode] directory ...
make[1]: *** [build] Error 64
Thanks.

Trialblazer47
Posts: 60
Joined: Mon Jun 26, 2017 5:36 am

Re: Full example of using spiffs with ESP32

Postby Trialblazer47 » Sat Aug 26, 2017 8:30 am

here is detailed error..

Code: Select all

Shirishs-MacBook-Pro:ESP32_spiffs_example shirishbytelens$ make V=1 all
including /Users/shirishbytelens/esp/esp-idf/components/bootloader/Makefile.projbuild...
including /Users/shirishbytelens/esp/esp-idf/components/bootloader_support/Makefile.projbuild...
including /Users/shirishbytelens/esp/esp-idf/components/coap/Makefile.projbuild...
including /Users/shirishbytelens/esp/esp-idf/components/esp32/Makefile.projbuild...
including /Users/shirishbytelens/esp/esp-idf/components/esptool_py/Makefile.projbuild...
including /Users/shirishbytelens/esp/esp-idf/components/mbedtls/Makefile.projbuild...
including /Users/shirishbytelens/esp/ESP32_spiffs_example/components/mkspiffs/Makefile.projbuild...
including /Users/shirishbytelens/esp/esp-idf/components/nghttp/Makefile.projbuild...
including /Users/shirishbytelens/esp/esp-idf/components/partition_table/Makefile.projbuild...
including /Users/shirishbytelens/esp/ESP32_spiffs_example/components/spiffs_image/Makefile.projbuild...
including /Users/shirishbytelens/esp/esp-idf/components/ulp/Makefile.projbuild...
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/esp-idf/components/bootloader/src V=1 BUILD_DIR_BASE=/Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader TEST_COMPONENTS= TESTS_ALL= /Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader/bootloader.bin
including /Users/shirishbytelens/esp/esp-idf/components/esptool_py/Makefile.projbuild...
including /Users/shirishbytelens/esp/esp-idf/components/bootloader/Makefile.projbuild...
including /Users/shirishbytelens/esp/esp-idf/components/bootloader_support/Makefile.projbuild...
including /Users/shirishbytelens/esp/esp-idf/components/bootloader/src/main/Makefile.projbuild...
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader/bootloader_support -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/bootloader_support/component.mk COMPONENT_NAME=bootloader_support build
Target 'bootloader_support-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader/bootloader_support/libbootloader_support.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader/log -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/log/component.mk COMPONENT_NAME=log build
Target 'log-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader/log/liblog.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader/spi_flash -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/spi_flash/component.mk COMPONENT_NAME=spi_flash build
Target 'spi_flash-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader/spi_flash/libspi_flash.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader/micro-ecc -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/micro-ecc/component.mk COMPONENT_NAME=micro-ecc build
Target 'micro-ecc-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader/micro-ecc/libmicro-ecc.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader/soc -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/soc/component.mk COMPONENT_NAME=soc build
Target 'soc-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader/soc/libsoc.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader/main -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/bootloader/src/main/component.mk COMPONENT_NAME=main build
Target 'main-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader/main/libmain.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/app_update -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/app_update/component.mk COMPONENT_NAME=app_update build
Target 'app_update-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/app_update/libapp_update.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader_support -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/bootloader_support/component.mk COMPONENT_NAME=bootloader_support build
Target 'bootloader_support-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/bootloader_support/libbootloader_support.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/bt -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/bt/component.mk COMPONENT_NAME=bt build
Target 'bt-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/bt/libbt.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/coap -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/coap/component.mk COMPONENT_NAME=coap build
Target 'coap-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/coap/libcoap.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/cxx -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/cxx/component.mk COMPONENT_NAME=cxx build
Target 'cxx-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/cxx/libcxx.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/driver -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/driver/component.mk COMPONENT_NAME=driver build
Target 'driver-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/driver/libdriver.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/esp32 -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/esp32/component.mk COMPONENT_NAME=esp32 build
Target 'esp32-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/esp32/libesp32.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/ethernet -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/ethernet/component.mk COMPONENT_NAME=ethernet build
Target 'ethernet-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/ethernet/libethernet.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/expat -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/expat/component.mk COMPONENT_NAME=expat build
Target 'expat-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/expat/libexpat.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/fatfs -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/fatfs/component.mk COMPONENT_NAME=fatfs build
Target 'fatfs-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/fatfs/libfatfs.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/freertos -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/freertos/component.mk COMPONENT_NAME=freertos build
Target 'freertos-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/freertos/libfreertos.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/jsmn -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/jsmn/component.mk COMPONENT_NAME=jsmn build
Target 'jsmn-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/jsmn/libjsmn.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/json -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/json/component.mk COMPONENT_NAME=json build
Target 'json-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/json/libjson.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/log -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/log/component.mk COMPONENT_NAME=log build
Target 'log-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/log/liblog.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/lwip -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/lwip/component.mk COMPONENT_NAME=lwip build
Target 'lwip-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/lwip/liblwip.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/mbedtls -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/mbedtls/component.mk COMPONENT_NAME=mbedtls build
Target 'mbedtls-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/mbedtls/libmbedtls.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/mdns -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/mdns/component.mk COMPONENT_NAME=mdns build
Target 'mdns-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/mdns/libmdns.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/micro-ecc -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/esp-idf/components/micro-ecc/component.mk COMPONENT_NAME=micro-ecc build
Target 'micro-ecc-build' responsible for '/Users/shirishbytelens/esp/ESP32_spiffs_example/build/micro-ecc/libmicro-ecc.a'
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/shirishbytelens/esp/ESP32_spiffs_example/build/mkspiffs -f /Users/shirishbytelens/esp/esp-idf/make/component_wrapper.mk COMPONENT_MAKEFILE=/Users/shirishbytelens/esp/ESP32_spiffs_example/components/mkspiffs/component.mk COMPONENT_NAME=mkspiffs build
usage: mkdir [-pv] [-m mode] directory ...
make[1]: *** [build] Error 64
make: *** [mkspiffs-build] Error 2
Thanks.

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Full example of using spiffs with ESP32

Postby loboris » Sat Aug 26, 2017 10:20 am

It looks like the problem is with esp-idf version used.

If using the master branch, always update to the latest commit:
cd to your esp-idf directory, then execute:

Code: Select all

git pull
git submodule update --init --recursive
After that the build should finish without error.

Note: After updating esp-idf you must (almost) always run

Code: Select all

make menuconfig
in your project directory first.

If you are using the older esp-idf commit, or release branch (v2.0 or v2.1), here is the solution:

delete (or rename - add .back extension) the files:
components/mkspiffs/component.mk and
components/spiffs_image/component.mk

After that the build should finish without error.

sukeshak
Posts: 49
Joined: Sat Aug 19, 2017 10:20 am

Re: Full example of using spiffs with ESP32

Postby sukeshak » Tue Sep 26, 2017 1:54 pm

Any difference with your SPIFFS implementation and the one on ESP-IDF ?
https://github.com/espressif/esp-idf/tr ... age/spiffs

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Full example of using spiffs with ESP32

Postby loboris » Tue Sep 26, 2017 6:29 pm

The spiffs implementation which is now included in esp-idf is mostly the same as mine, so there is not much reason to use the library which I've proposed.

The only difference of which I'm aware is that my implementation has full support for file's timestamp (atime,mtime,ctime) which is missing from esp-idf/spiffs.
It is important for my applications, so I will continue to use my spiffs implementation for now.

Who is online

Users browsing this forum: No registered users and 40 guests