Page 1 of 1

flashing spiffs outside esp-idf [solved]

Posted: Sat Jul 07, 2018 12:09 am
by linuxpaul
Hello Forum,

in order flashing images I built esptool and mkspiffs as a standalone exe for Windows,
because I'd like to config my little app outside an esp-idf.
Both exe seem work fine, but with the exe stuff no data are read from the config.txt.

Making the spiffs image on Windows:

Code: Select all

mkspiffs.exe -d 5 -c image -b 4096 -p 256 -s 1048576 spiffs.bin
esptool.exe --chip esp32 --port COM3 --baud 115200 write_flash -z 0x110000 spiffs.bin
output

Code: Select all

D:\Source\esp\bitbucket\esp32-uartbridge\bin>mkspiffs -d 5 -c image -b 4096 -p 256 -s 1048576 spiffs.bin
Debug output enabled
/config.txt
file size: 36

D:\Source\esp\bitbucket\esp32-uartbridge\bin>esptool.exe --chip esp32 --port COM3 --baud 115200 write_flash -z 0x110000 spiffs.bin
esptool.py v2.2.1
Connecting........_
Chip is ESP32D0WDQ6 (revision 0)
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 1048576 bytes to 2088...
Wrote 1048576 bytes (2088 compressed) at 0x00110000 in 0.2 seconds (effective 39945.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...

D:\Source\esp\bitbucket\esp32-uartbridge\bin>flash_config.cmd

D:\Source\esp\bitbucket\esp32-uartbridge\bin>mkspiffs.exe -d 5 -c image -b 4096 -p 256 -s 1048576 spiffs.bin
Debug output enabled
/config.txt
file size: 36
result on MONITOR:

Code: Select all

I (0) cpu_start: App cpu up.
I (210) heap_init: Initializing. RAM available for dynamic allocation:
I (217) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (223) heap_init: At 3FFB29D8 len 0002D628 (181 KiB): DRAM
I (229) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (235) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (242) heap_init: At 40088B48 len 000174B8 (93 KiB): IRAM
I (248) cpu_start: Pro cpu start user code
I (266) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (353) ...SPIFFS...: Initializing SPIFFS
I (463) ...SPIFFS...: Partition size: total: 956561, used: 502
I (463) config.txt:  bytes read: 0
config.txt is present and epened for reading but seems empty.
(If fopen results in an Error, a message would shown)

same procedure within esp-idf (msys2)

Code: Select all

$ make makefs
Making spiffs image ...
/config.txt

$ make flashfs monitor
Make & flash spiffs image ...
/config.txt
esptool.py v2.2.1
Connecting........_
Chip is ESP32D0WDQ6 (revision 0)
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 1048576 bytes to 2089...
Wrote 1048576 bytes (2089 compressed) at 0x00110000 in 0.2 seconds (effective 39945.7 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...
MONITOR
.....
I (0) cpu_start: App cpu up.
I (210) heap_init: Initializing. RAM available for dynamic allocation:
I (217) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (223) heap_init: At 3FFB29D8 len 0002D628 (181 KiB): DRAM
I (229) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (235) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (242) heap_init: At 40088B48 len 000174B8 (93 KiB): IRAM
I (248) cpu_start: Pro cpu start user code
I (266) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (353) ...SPIFFS...: Initializing SPIFFS
I (463) ...SPIFFS...: Partition size: total: 956561, used: 502
I (463) config.txt:  bytes read: 36
I (463) config.txt: SSID wlanssid
I (473) config.txt: PW wlanpw
Are there any hints where is the difference?

:)
linuxpaul

Re: flashing spiffs outside esp-idf

Posted: Sat Jul 07, 2018 12:36 pm
by linuxpaul
indeed there is a difference how the mkspiffs make the images.
So if I extract an image from one mkspiffs with the other one
a config.txt will be created, but the content is garbage.

Obvisouly there ist something happened while building the mkspiffs
with plain mingw32 outside the msys2 env. It seems not enough
install a plain mingw32 and run a make dist.

Do anybody know the right way compile a mkspiffs outside msys2?

:)
linuxpaul

Re: flashing spiffs outside esp-idf

Posted: Sat Jul 07, 2018 3:06 pm
by linuxpaul
Cry ....
this is coused by different kind of implementations.
Testing different stuff I use a directory which holds the extentions I cloned from the Internet,
from there I depoy them to the projects.
So I obvisouly did something wrong while cleaning up. SORRY :oops:

In the result I was working with two different versions/implemtations.
One Version of mkspiffs from https://github.com/loboris/ESP32_spiffs_example.git doesn't work at all in my case.
Neither msys2 nor plain mingw.

:oops:
linuxpaul

Re: flashing spiffs outside esp-idf [solved]

Posted: Sat Jul 07, 2018 7:06 pm
by linuxpaul
Regarding to loboris todays latest SPIFFS Example I may need edit include/sdkconfig.h
CONFIG_SPIFFS_META_LENGTH from 5 -> 4 and all works fine.

sdkconfig.h:

Code: Select all

#define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1
#define CONFIG_SPIFFS_CACHE_WR 1
#define CONFIG_SPIFFS_CACHE 1
#define CONFIG_SPIFFS_USE_DIR 1
#define CONFIG_SPIFFS_META_LENGTH 4
#define CONFIG_SPIFFS_USE_MAGIC 1
#define CONFIG_SPIFFS_PAGE_CHECK 1
#define CONFIG_SPIFFS_USE_MTIME 1
#define CONFIG_SPIFFS_GC_MAX_RUNS 10
#define CONFIG_SPIFFS_MAX_PARTITIONS 3
#define CONFIG_SPIFFS_OBJ_NAME_LEN 32
#define CONFIG_SPIFFS_PAGE_SIZE 256
:)
linuxpaul

Re: flashing spiffs outside esp-idf [solved]

Posted: Wed Sep 04, 2019 1:54 pm
by Marcwolf
Hi.
I am using the Arduino development environment and would like to have the capability to write a program to go on to the ESP32.. and then at a later date enable the end user to load a new SPIFFS file system on to it.

I have bot the executables esptools.exe and the mkspiffs.exe (the correct win32 Arduino version)

My issue is that I am totally confused as to how to run them with all the parameters like starting memory etc.

Can anyone show me a working example so i can understand this or just use it.

many thanks
Dave