I'm using mkspiffs to create a file system to write to a partition. Unfortunately when I try to open the single file stored on it (readme.txt), it fails to open the file. I can create the file, write to it, then read it back. But for some reason the file isn't recognized when written to the flash with esptool.
This is the version of mkspiffs.exe...
Build configuration name: esp-idf
SPIFFS ver. 0.3.7-5-gf5e26c4
Extra build flags: -DSPIFFS_OBJ_META_LEN=4
SPIFFS configuration:
SPIFFS_OBJ_NAME_LEN: 32
SPIFFS_OBJ_META_LEN: 4
SPIFFS_USE_MAGIC: 1
SPIFFS_USE_MAGIC_LENGTH: 1
SPIFFS_ALIGNED_OBJECT_INDEX_TABLES: 0
Using IDF 3.1.1 and this is in my sdkconfig file....
$ cat sdkconfig | grep SPIFFS
# SPIFFS Configuration
CONFIG_SPIFFS_MAX_PARTITIONS=3
# SPIFFS Cache Configuration
CONFIG_SPIFFS_CACHE=y
CONFIG_SPIFFS_CACHE_WR=y
CONFIG_SPIFFS_CACHE_STATS=
CONFIG_SPIFFS_PAGE_CHECK=y
CONFIG_SPIFFS_GC_MAX_RUNS=10
CONFIG_SPIFFS_GC_STATS=y
CONFIG_SPIFFS_PAGE_SIZE=256
CONFIG_SPIFFS_OBJ_NAME_LEN=32
CONFIG_SPIFFS_USE_MAGIC=y
CONFIG_SPIFFS_USE_MAGIC_LENGTH=y
CONFIG_SPIFFS_META_LENGTH=4
CONFIG_SPIFFS_USE_MTIME=y
CONFIG_SPIFFS_DBG=y
CONFIG_SPIFFS_API_DBG=
CONFIG_SPIFFS_GC_DBG=
CONFIG_SPIFFS_CACHE_DBG=
CONFIG_SPIFFS_CHECK_DBG=y
CONFIG_SPIFFS_TEST_VISUALISATION=
This my paritition table (I'm using the partition templates)...
# Name, Type, SubType, Offset, Size, Flags
# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000,
ota_0, 0, ota_0, 0x10000, 0x200000
ota_1, 0, ota_1, 0x210000, 0x200000
storage, data, spiffs, , 0xF0000,
templates, data, spiffs, , 0x100000,
I'm creating the file as follows....
./mkspiffs.exe -c tcfs -b 4096 -p 256 -s 0x100000 tcfs.bin
And writing it like this....
python $IDF_PATH/components/esptool_py/esptool/esptool.py --chip esp32 --port com3 --baud 921600 write_flash -z 0x500000 tcfs.bin
I mount it with...
esp_vfs_fat_spiflash_mount(tcffs_base_path, "templates", &mount_config, &s_wl_handle)
However this command always return an error....
esp_spiffs_info("templates", &size_bytes, &used_bytes);
If using esptool I do a "read_flash" that writes to a file I can see the text from readme.txt in the file. I've been using spiffs for a while with no problems. But this is the first time I've tried preparing a file system and writing to flash.
John A
Write filesystem to spiffs <SOLVED>
Write filesystem to spiffs <SOLVED>
Last edited by fly135 on Fri Dec 14, 2018 6:35 pm, edited 1 time in total.
Re: Write filesystem to spiffs
Hi,
I used https://github.com/loboris/ESP32_spiffs_example.git because it has directory support.
I only added a few large Gutenbergs to the example (no code or build changes) but seemed to serve them up well enough.
I used https://github.com/loboris/ESP32_spiffs_example.git because it has directory support.
I only added a few large Gutenbergs to the example (no code or build changes) but seemed to serve them up well enough.
& I also believe that IDF CAN should be fixed.
Re: Write filesystem to spiffs
I'm not really interested in viewing directories. Were you able to burn a file system to a partition and read it after boot? I'm using the most recent pre-built version of mkspiffs for the ESP IDF. The IDF docs describe using mkspiffs to create and burn a file system. It would be nice if someone could confirm that it actually works on IDF release 3.1.1.PeterR wrote: ↑Tue Dec 11, 2018 4:13 pmHi,
I used https://github.com/loboris/ESP32_spiffs_example.git because it has directory support.
I only added a few large Gutenbergs to the example (no code or build changes) but seemed to serve them up well enough.
John A
Re: Write filesystem to spiffs
So now I've downloaded the file via HTTP and wrote it to the file system. I can read it back in my application. But if I use esptool to read the partition into a bin file, mkspiffss fails to mount the FS.
I am using the latest mkspiffs build and the version info verifies it's built for the ESP32....
"Build configuration name: esp-idf"
But it doesn't seem compatible with IDF release v3.1.1
John A
I am using the latest mkspiffs build and the version info verifies it's built for the ESP32....
"Build configuration name: esp-idf"
But it doesn't seem compatible with IDF release v3.1.1
John A
Re: Write filesystem to spiffs
Yes. I added a couple of .txt books to the referenced example. As I recall the example contains a webserver and you could see all in the browser - the browser being feed by a file system.Were you able to burn a file system to a partition and read it after boot? I'm using the most recent pre-built version of mkspiffs for the ESP IDF. The IDF docs describe using mkspiffs to create and burn a file system. It would be nice if someone could confirm that it actually works on IDF release 3.1.1.
My CM was a bit sloppy at the time (surveying/prototyping).
I doubt that I was on 3.1.1.
Its most likely that I was on ESP-IDF v3.2-dev-760-ga0d2dd03 but have since moved on to v3.2-beta1-34-gfb7ba1baa
Hope that helps.
I will be picking SPIFFS up early January as I need to add the webserver. Be keen to hear how you get on.
& I also believe that IDF CAN should be fixed.
Re: Write filesystem to spiffs
Can we not get an Espressif engineer to comment on this? I ask because it's part of the official v3.1.1 documentation posted on the Espressif site that this is supported, and it does not work.
John A
John A
Re: Write filesystem to spiffs
Hi John,
I was able to generate a SPIFFS image using mkspiffs, upload it to flash, and get the slightly modified spiffs example from IDF 3.1.1 to read it. The modification was to disable creating, removing, and renaming parts of the example, and keep only reading from foo.txt.
My commands on the host side:
cd $IDF_PATH/examples/storage/spiffs
rm -rf build sdkconfig
(modify example code as explained above)
idf.py flash
(download mkspiffs release)
unzip ~/Downloads/mkspiffs-0.2.3-esp-idf-win32.zip
cd mkspiffs-0.2.3-esp-idf-win32
mkdir data
echo "Hello from mkspiffs" > data/foo.txt
./mkspiffs.exe -c data -s 0xF0000 spiffs.bin
$IDF_PATH/components/esptool_py/esptool/esptool.py --port COM9 --baud 921600 write_flash 0x110000 spiffs.bin
cd -
idf.py monitor
After this, example runs and prints "Hello from mkspiffs".
Edit:
https://docs.espressif.com/projects/esp ... l_handle_t
esp_vfs_spiffs_register may work better if you are preparing a SPIFFS partition.
https://docs.espressif.com/projects/esp ... ffs_conf_t
I was able to generate a SPIFFS image using mkspiffs, upload it to flash, and get the slightly modified spiffs example from IDF 3.1.1 to read it. The modification was to disable creating, removing, and renaming parts of the example, and keep only reading from foo.txt.
My commands on the host side:
cd $IDF_PATH/examples/storage/spiffs
rm -rf build sdkconfig
(modify example code as explained above)
idf.py flash
(download mkspiffs release)
unzip ~/Downloads/mkspiffs-0.2.3-esp-idf-win32.zip
cd mkspiffs-0.2.3-esp-idf-win32
mkdir data
echo "Hello from mkspiffs" > data/foo.txt
./mkspiffs.exe -c data -s 0xF0000 spiffs.bin
$IDF_PATH/components/esptool_py/esptool/esptool.py --port COM9 --baud 921600 write_flash 0x110000 spiffs.bin
cd -
idf.py monitor
After this, example runs and prints "Hello from mkspiffs".
Edit:
FAT?..esp_vfs_fat_spiflash_mount(tcffs_base_path, "templates", &mount_config, &s_wl_handle)
https://docs.espressif.com/projects/esp ... l_handle_t
esp_vfs_spiffs_register may work better if you are preparing a SPIFFS partition.
https://docs.espressif.com/projects/esp ... ffs_conf_t
Re: Write filesystem to spiffs
Thank you so much! The call to esp_vfs_spiffs_register was the solution!ESP_igrr wrote: ↑Fri Dec 14, 2018 4:01 amFAT?..esp_vfs_fat_spiflash_mount(tcffs_base_path, "templates", &mount_config, &s_wl_handle)
https://docs.espressif.com/projects/esp ... l_handle_t
esp_vfs_spiffs_register may work better if you are preparing a SPIFFS partition.
https://docs.espressif.com/projects/esp ... ffs_conf_t
John A
Who is online
Users browsing this forum: **txf** and 151 guests