Flash script improved
This commit is contained in:
parent
c2b40f692d
commit
0e8fc88646
27
os/flash.sh
27
os/flash.sh
@ -1,34 +1,33 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -ne 1 ]; then
|
||||||
echo "One parameter required: the device of the serial interface"
|
|
||||||
echo "$0 <device>"
|
|
||||||
echo "e.g.:"
|
|
||||||
echo "$0 /dev/ttyUSB0"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
DEVICE=$1
|
DEVICE=$1
|
||||||
#BAUD="--baud 57600"
|
|
||||||
#BAUD="--baud 921600"
|
|
||||||
|
|
||||||
# check the serial connection
|
# check the serial connection
|
||||||
|
|
||||||
if [ ! -c $DEVICE ]; then
|
if [ ! -c $DEVICE ]; then
|
||||||
echo "$DEVICE does not exist"
|
echo "$DEVICE does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
print "Autodetect serial port"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -f esptool.py ]; then
|
if [ ! -f esptool.py ]; then
|
||||||
echo "Cannot found the required tool:"
|
echo "Cannot found the required tool:"
|
||||||
echo "esptool.py"
|
echo "esptool.py"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
python3 esptool.py --port $DEVICE $BAUD read_mac
|
|
||||||
|
CMD="python3 esptool.py "
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
CMD="python3 esptool.py --port $DEVICE "
|
||||||
|
fi
|
||||||
|
|
||||||
|
$CMD read_mac
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Error reading the MAC -> set the device into the bootloader!"
|
echo "Error reading the MAC -> set the device into the bootloader!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Flashing the new"
|
echo "Flashing the new firmware"
|
||||||
python3 esptool.py --port $DEVICE write_flash -fm dio 0x00000 0x00000.bin 0x10000 0x10000.bin 0x3fc000 esp_init_data_default.bin
|
$CMD write_flash -fm dio 0x00000 0x00000.bin 0x10000 0x10000.bin 0x3fc000 esp_init_data_default.bin
|
||||||
|
Loading…
Reference in New Issue
Block a user