2016-04-12 18:07:25 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ $# -ne 1 ]; then
|
2021-01-31 16:13:44 +01:00
|
|
|
DEVICE=$1
|
2016-04-12 18:07:25 +02:00
|
|
|
# check the serial connection
|
2020-12-07 20:02:01 +01:00
|
|
|
if [ ! -c $DEVICE ]; then
|
|
|
|
echo "$DEVICE does not exist"
|
2016-04-12 18:07:25 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-01-31 16:13:44 +01:00
|
|
|
else
|
|
|
|
print "Autodetect serial port"
|
|
|
|
fi
|
|
|
|
|
2016-04-12 18:07:25 +02:00
|
|
|
if [ ! -f esptool.py ]; then
|
|
|
|
echo "Cannot found the required tool:"
|
|
|
|
echo "esptool.py"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-01-31 16:13:44 +01:00
|
|
|
|
|
|
|
CMD="python3 esptool.py "
|
|
|
|
if [ $# -eq 1 ]; then
|
|
|
|
CMD="python3 esptool.py --port $DEVICE "
|
|
|
|
fi
|
|
|
|
|
|
|
|
$CMD read_mac
|
2016-04-12 18:07:25 +02:00
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Error reading the MAC -> set the device into the bootloader!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-01-31 16:13:44 +01:00
|
|
|
echo "Flashing the new firmware"
|
|
|
|
$CMD write_flash -fm dio 0x00000 0x00000.bin 0x10000 0x10000.bin 0x3fc000 esp_init_data_default.bin
|