Last active
November 11, 2018 16:09
-
-
Save jiachengx/c55729e26e289e4125b4e83a81cf4a80 to your computer and use it in GitHub Desktop.
ESP flash tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Aurhor: JC | |
if [ -z $1 ] || [ -z $2 ]; then | |
printf "Usage:\n\t $0 sID port e.g $0 S5 0\n" | |
exit 0 | |
fi | |
sid=$1 | |
port=$2 | |
ver="1.00.18.101" | |
t_macaddr="t_macaddr" # Record each MAC address and label | |
espfile="/opt/micropython/bin/esp8266-20180511-v1.9.4.bin" | |
# Modify the WiFi.cfg | |
printf "$0 ver. ${ver}\n" | |
# Get the Flash info and then parse the mac address | |
mac=$(esptool.py --port /dev/ttyUSB${port} flash_id | awk -F 'MAC:' '{print $2}' | tr -d " " | tr -d "\r\n" | tr '[:lower:]' '[:upper:]') | |
printf "MAC address: ${mac}\n" | |
printf "${sid}: ${mac}\n" | tee -a ${t_macaddr} | |
# Erase the ESP01s | |
esptool.py --port /dev/ttyUSB${port} erase_flash | |
# Download the firmware | |
esptool.py --port /dev/ttyUSB${port} --baud 460800 write_flash --flash_size detect 0 ${espfile} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update the espflash 2nd version. Add label variable