scripts: update to cargo-espflash v2.0.0

This commit is contained in:
irriden
2023-06-30 21:34:18 +00:00
parent 09b38d5e84
commit 7ada3b64ba
3 changed files with 17 additions and 11 deletions

View File

@@ -4,7 +4,7 @@ check_exists() {
command -v "$1" > /dev/null command -v "$1" > /dev/null
} }
check_port() { check_port() {
cargo espflash board-info "$1" &> /dev/null cargo espflash board-info --port "$1" &> /dev/null
} }
if ! check_exists esptool.py if ! check_exists esptool.py
then then
@@ -65,7 +65,7 @@ fi
esptool.py erase_flash && esptool.py erase_flash &&
git pull && git pull &&
cd factory && cd factory &&
cargo espflash --release $PORT && cargo espflash flash --release --port $PORT &&
cd ../sphinx-key && cd ../sphinx-key &&
if [ $MODE = "release" ] if [ $MODE = "release" ]
@@ -77,4 +77,4 @@ fi &&
esptool.py --chip esp32-c3 elf2image ../target/riscv32imc-esp-espidf/$MODE/sphinx-key && esptool.py --chip esp32-c3 elf2image ../target/riscv32imc-esp-espidf/$MODE/sphinx-key &&
esptool.py --chip esp32c3 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x80000 ../target/riscv32imc-esp-espidf/$MODE/sphinx-key.bin && esptool.py --chip esp32c3 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x80000 ../target/riscv32imc-esp-espidf/$MODE/sphinx-key.bin &&
cargo espflash serial-monitor $PORT cargo espflash monitor --port $PORT

View File

@@ -2,7 +2,7 @@ check_exists() {
command -v "$1" > /dev/null command -v "$1" > /dev/null
} }
check_port() { check_port() {
cargo espflash board-info "$1" &> /dev/null cargo espflash board-info --port "$1" &> /dev/null
} }
if ! check_exists esptool.py if ! check_exists esptool.py
then then
@@ -31,9 +31,17 @@ do
fi fi
done done
if [ -z "$PORT" ] if [ -z "$PORT" ]
then
# Check for port on linux
if check_port /dev/ttyUSB0
then
PORT=/dev/ttyUSB0
fi
fi
if [ -z "$PORT" ]
then then
echo "ESP likely not connected! Exiting now." echo "ESP likely not connected! Exiting now."
echo "Make sure the ESP is connected with a data USB cable, and try again." echo "Make sure the ESP is connected with a data USB cable, and try again."
exit 1 exit 1
fi fi
cargo espflash serial-monitor $PORT cargo espflash monitor --port $PORT

View File

@@ -1,12 +1,10 @@
MODE=debug # MODE=debug
# MODE=release MODE=release
SSID=sphinx
PASS=sphinxkey
check_exists() { check_exists() {
command -v "$1" > /dev/null command -v "$1" > /dev/null
} }
check_port() { check_port() {
cargo espflash board-info "$1" &> /dev/null cargo espflash board-info --port "$1" &> /dev/null
} }
if ! check_exists esptool.py if ! check_exists esptool.py
then then
@@ -72,4 +70,4 @@ else
fi && fi &&
esptool.py --chip esp32-c3 elf2image ../target/riscv32imc-esp-espidf/$MODE/sphinx-key && esptool.py --chip esp32-c3 elf2image ../target/riscv32imc-esp-espidf/$MODE/sphinx-key &&
esptool.py --chip esp32c3 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x80000 ../target/riscv32imc-esp-espidf/$MODE/sphinx-key.bin && esptool.py --chip esp32c3 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x80000 ../target/riscv32imc-esp-espidf/$MODE/sphinx-key.bin &&
cargo espflash serial-monitor $PORT cargo espflash monitor --port $PORT