Reputation: 11
I am working on an application generator tool for esp8266 devices and cannot use properly the mkspiffs and esptool tools.
I have read the available documentation for mkspiffs and esptool, also enabled the verbose output in the Arduino IDE to see how Arduino IDE uses these programs work but still couldn't make it work properly.
In the ESP Core documentation there is some info about the address map (https://arduino-esp8266.readthedocs.io/en/latest/filesystem.html) but I am not sure how to properly set build parameters according to this.
My goal is to upload an application binary and a 1M SPIFFS binary on a 4M flash size device.
This is where I am right now:
I use "arduino-cli compile" to build my application binary. There is an output bin, I can upload it and it seem to work properly. In the fqbn I am using properties that I copied from the verbose output from the Arduino IDE when building an app (some debug is also enabled).
I use mkspiffs to create a SPIFFS binary. I"m not sure if it is 100% correct but there is an output binary that I can list and unpack it with mkspiffs. Size, page and block size parameters are also taken from the Arduino IDE verbose output.
I use esptool to upload both the application and the SPIFFS binary.
All of these commands run and return with 0 so seem to be OK.
The command for the build of the application bin:
arduino-cli.exe compile --fqbn=esp8266:esp8266:d1_mini:xtal=80,vt=flash,exception=disabled,eesz=4M1M,ip=lm2f,dbg=Serial,lvl=COREWIFIHTTP_UPDATEUPDATEROTAOOM,wipe=none,baud=921600 C:\codefolder --build-path C:\app_output.bin
The command for the build of the SPIFFS binary:
mkspiffs -c C:\datafolder -b 8192 -p 256 -s 0xFB000 C:\spiffs_output.bin
The command for uploading these bins:
esptool.exe --port COM1 --baud 512000 write_flash 0x000000 app_output.bin 0x300000 spiffs_output.bin
The application on the ESP8266 runs properly, the SPIFFS mounts but none of the files are found by the application running on the ESP8266. How can I properly do this?
Upvotes: 1
Views: 2673
Reputation: 1
Here is a suggestion/remark (finding your post 4 years later...), as it does not yet give a solution, but highlights something surprising. Note that this remark comes from the *nix usage, might differ on your platform, but maybe not, I do not have any Microsoft Windows to try.
When you build the application with arduino-cli
, the parameter --build-path
expect a directory to put all the build'ing files, including the "final" binary, which should be C:\app_output.bin\<your_application_ino_filename>.bin
.
Then in esptool.exe --port COM1 --baud 512000 write_flash 0x000000 app_output.bin 0x300000 spiffs_output.bin
your should have C:\app_output.bin\<your_application_ino_filename>.bin
instead of app_output.bin
something more like that (again, this is how it would work under *nix):
esptool.exe --port COM1 --baud 512000 write_flash 0x000000 C:\app_output.bin<your_application_ino_filename>.bin 0x300000 spiffs_output.bin
A note you can only flash the SPIFFS data with:
esptool.exe --port COM1 --baud 512000 write_flash 0x300000 spiffs_output.bin
This is where I do not get your remark, maybe the command simply fails and the core is running the previously flashed binary... this is surprising anyhow.
Maybe try to wipe the entire flash memory prior to anything
esptool.exe --port COM1 erase_flash
Upvotes: 0