Flash script for esptool on Linux
Moderators: grovkillen, Stuntteam, TD-er
Flash script for esptool on Linux
Hi guys,
first of all i was very impressed of EspEasy as i started to use it days ago. I had some WemoS D1 mini ordered months ago for smart home applications and now it was so easy to get them to fhem.
During flashing the first chips i tried the "Stable" R120 Download which has a flashscript for windows users in the zipfile. As i'm a strict Linux-user i just ported the windows batch to Linus shell and wanted to share it here. If this and the binary for espttol could've been added to the download this could make it way easier for linux systems. (There is a confusing different kind of "esptool" available with complete different syntax).
Cheers from germany
Felix
first of all i was very impressed of EspEasy as i started to use it days ago. I had some WemoS D1 mini ordered months ago for smart home applications and now it was so easy to get them to fhem.
During flashing the first chips i tried the "Stable" R120 Download which has a flashscript for windows users in the zipfile. As i'm a strict Linux-user i just ported the windows batch to Linus shell and wanted to share it here. If this and the binary for espttol could've been added to the download this could make it way easier for linux systems. (There is a confusing different kind of "esptool" available with complete different syntax).
Cheers from germany
Felix
- Attachments
-
- ESPEasy_Flashutils.zip
- Flash scripts and esptool for Windows and Linux
- (32.03 KiB) Downloaded 2255 times
-
- Normal user
- Posts: 103
- Joined: 16 Sep 2015, 20:32
Re: Flash script for esptool on Linux
Linux user since 2 months here
Thanks!!
Thanks!!
Re: Flash script for esptool on Linux
Thank you for this tool, I like the idea of being able to flash ESPEasy from within my linux environment.felixm wrote: ........
As i'm a strict Linux-user i just ported the windows batch to Linus shell and wanted to share it here. If this and the binary for espttol could've been added to the download this could make it way easier for linux systems. (There is a confusing different kind of "esptool" available with complete different syntax).
........
It must be my ignorance but sadly I cannot make this tool/command do what it is supposed to do.
Is it possible that you provide a sort of helpfile, explaining how to use this tool ?
Re: Flash script for esptool on Linux
Hei guys,
at first sorry for the late answer, so much to do, so little time.
Basicly i tried to make the use similar to the windows tool.
Obviously it's to simple
: Just start the script without any params, everything will be asked at runtime.
The script asks for: Serial Port (Default: "/dev/ttyUSB0"), Flash Size (Depending on BoardVersion, for me on Wemos D1 mini 4096K) and Build number (Default 120 because its the latest stable).
The file is expected in the current directory. If it's there it will be flashed.
Felix
at first sorry for the late answer, so much to do, so little time.

Basicly i tried to make the use similar to the windows tool.
Obviously it's to simple

The script asks for: Serial Port (Default: "/dev/ttyUSB0"), Flash Size (Depending on BoardVersion, for me on Wemos D1 mini 4096K) and Build number (Default 120 because its the latest stable).
The file is expected in the current directory. If it's there it will be flashed.
Felix
Re: Flash script for esptool on Linux
Saw your script too late, so wrote my own one.
This one looks for
* esptool
* firmware images
and presents a list of found ones, so it should also work for other releases.
This one looks for
* esptool
* firmware images
and presents a list of found ones, so it should also work for other releases.
Code: Select all
#!/bin/bash
selectst=""
for i in ESPEasy*bin
do
selectst="$i $i off $selectst"
done
# check for esptool
esptoolbin=$(which esptool)
if [ ! -x "$esptoolbin" ] ; then
if [ -x "./esptool" ] ; then
esptoolbin="./esptool"
else
eardu=$(find $HOME/.arduino15/packages/esp8266/tools/esptool/* -name esptool|sort|tail -1)
if [ -x "$eardu" ] ; then
echo "found esptool: $eardu"
esptoolbin="$eardu"
fi
fi
fi
if [ ! -x "$esptoolbin" ] ; then
echo "esptool not found, you can link it here or put in \$PATH"
exit 2
else
echo "using esptool $esptoolbin"
fi
read -e -p "serial device, (USB2serial devices: $(ls /dev/ttyUSB*)):" -i "/dev/ttyUSB0" serdev
if [ ! -r "$serdev" ] ; then
echo "device '$serdev' does not exist"
exit 2
fi
if [ -n "$(which dialog)" ] ; then
cmd=(dialog --radiolist "Select firmware" 22 76 16)
choice=$("${cmd[@]}" ${selectst} 2>&1 >/dev/tty)
else
# bash only, do it with an array
fa=(ESPEasy_*.bin)
cnt=0
nfa=${#fa[*]}
while [ $cnt -lt $nfa ]
do
echo $cnt ${fa[$cnt]}
((cnt++))
done
read -p "choose number of firmware file to flash [0-$((nfa-1))]: " nsel
choice=${fa[$nsel]}
if [ ! -f "$choice" ] ; then
echo "cannot find file \"$choice\", exiting"
exit 2
fi
fi
echo "----"
read -p "flash $choice? [Y/n]" yn
if [ "$yn" != "n" ] ; then
"$esptoolbin" -vv -cd nodemcu -cb 115200 -cp "$serdev" -ca 0x00000 -cf "$choice"
fi
Re: Flash script for esptool on Linux
Is there any place/repo for a pull request?
-
- Normal user
- Posts: 103
- Joined: 16 Sep 2015, 20:32
Re: Flash script for esptool on Linux
Best to place it in the wikithonshic wrote:Is there any place/repo for a pull request?
A good place would be here:
http://www.letscontrolit.com/wiki/index ... are_Upload
Re: Flash script for esptool on Linux
nothing of any importance but maybe helpful for beginners who are struggling with other problems.
the binaries must have been renamed, so none of the bin-files will be selected, by none of the two really helpful scripts described here:
https://www.letscontrolit.com/wiki/inde ... ript_linux
Super simple reason: '_' missing ... not in the zip-archive's name but the binaries stored within the zip's.
Scripts are looking for filenames like 'ESPEasy', name of the bin's: 'ESP_Easy'
the binaries must have been renamed, so none of the bin-files will be selected, by none of the two really helpful scripts described here:
https://www.letscontrolit.com/wiki/inde ... ript_linux
Super simple reason: '_' missing ... not in the zip-archive's name but the binaries stored within the zip's.
Scripts are looking for filenames like 'ESPEasy', name of the bin's: 'ESP_Easy'
Re: Flash script for esptool on Linux
Thanks for the bug report @obod0002c, I edited it in the wiki, hopefully it works now (untested)...
Re: Flash script for esptool on Linux
Did esptool had major changes since you wrote the script? I have following error:
I'm using February 2020 esptool.py 2.8
https://manpages.debian.org/testing/esp ... .1.en.html
Code: Select all
...
esptool: error: argument --chip/-c: invalid choice: 'p' (choose from 'auto', 'esp8266', 'esp32')
https://manpages.debian.org/testing/esp ... .1.en.html
Re: Flash script for esptool on Linux
Fixed it quickly:
Best would be to integrate esptool actions (write_flash, erase_flash...) in a choice list first if someone has some time.
Code: Select all
fi
echo "----"
read -p "flash $choice? [Y/n]" yn
if [ "$yn" != "n" ] ; then
"$esptoolbin" -b 115200 -p "$serdev" write_flash 0x00000 "$choice"
Who is online
Users browsing this forum: No registered users and 21 guests