Skip to content

Instantly share code, notes, and snippets.

@deadprogram
Created January 30, 2019 07:56
Show Gist options
  • Save deadprogram/a4adb1a97186d59d947c48e701cfbff2 to your computer and use it in GitHub Desktop.
Save deadprogram/a4adb1a97186d59d947c48e701cfbff2 to your computer and use it in GitHub Desktop.
Script to flash ESP8266 with updated version of the official AT command set firmware.
#!/bin/sh
SPToolDir="$HOME/.local/lib/python2.7/site-packages"
FirmwareDir="$HOME/ESP8266_NONOS_SDK"
cd "$SPToolDir"
port=/dev/ttyUSB0
if [ ! -c $port ]; then
port=/dev/ttyUSB0
fi
if [ ! -c $port ]; then
echo "No device appears to be plugged in. Stopping."
fi
printf "Writing AT firmware to the ESP8266 in 3..."
sleep 1; printf "2..."
sleep 1; printf "1..."
sleep 1; echo "done."
echo "Erasing the flash first"
sudo python esptool.py --port $port erase_flash
sudo python esptool.py --port /dev/ttyUSB0 --baud 115200 \
write_flash -fm dio -ff 20m -fs detect \
0x0000 "$FirmwareDir/bin/boot_v1.7.bin" \
0x01000 "$FirmwareDir/bin/at/512+512/user1.1024.new.2.bin" \
0x3fc000 "$FirmwareDir/bin/esp_init_data_default_v05.bin" \
0x7e000 "$FirmwareDir/bin/blank.bin" \
0x3fe000 "$FirmwareDir/bin/blank.bin"
echo "Check the boot by typing: screen $port 115200"
echo " and then resetting the board. After some garbled data"
echo " due to the baud rate negotiation, you should see 'ready'"
echo "Use Ctrl-A Ctrl-D to quit screen"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment