diff --git a/deploy.sh b/deploy.sh index ca5eeeb..b1e3990 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,3 +1,7 @@ +#!/bin/bash + +set -e + check_exists() { command -v "$1" > /dev/null } @@ -26,13 +30,13 @@ then exit 1 fi cargo espflash erase-flash -cd factory && -cargo espflash flash --release && -cargo espflash save-image --release --chip esp32c3 factory.bin && -espsecure.py sign_data factory.bin --version 2 --keyfile ../secure_boot_signing_key.pem && -espflash write-bin 0x10000 factory.bin && -cd ../sphinx-key && -cargo espflash save-image --bin sphinx-key --release --chip esp32c3 sphinx-key.bin && -espsecure.py sign_data sphinx-key.bin --version 2 --keyfile ../secure_boot_signing_key.pem && -espflash write-bin 0x50000 sphinx-key.bin && +cd factory +cargo espflash flash --release +cargo espflash save-image --release --chip esp32c3 factory.bin +espsecure.py sign_data factory.bin --version 2 --keyfile ../secure_boot_signing_key.pem +espflash write-bin 0x10000 factory.bin +cd ../sphinx-key +cargo espflash save-image --bin sphinx-key --release --chip esp32c3 sphinx-key.bin +espsecure.py sign_data sphinx-key.bin --version 2 --keyfile ../secure_boot_signing_key.pem +espflash write-bin 0x50000 sphinx-key.bin cargo espflash monitor diff --git a/monitor.sh b/monitor.sh index 96dcfc2..c7fca86 100755 --- a/monitor.sh +++ b/monitor.sh @@ -1,9 +1,8 @@ +#!/bin/bash + check_exists() { command -v "$1" > /dev/null } -check_port() { - cargo espflash board-info --port "$1" &> /dev/null -} if ! check_exists esptool.py then echo "esptool.py not installed!" @@ -22,26 +21,4 @@ then echo "install with this command: cargo install cargo-espflash" exit 1 fi -for FILE in /dev/tty.* -do - if check_port $FILE - then - PORT=$FILE - break - fi -done -if [ -z "$PORT" ] -then - # Check for port on linux - if check_port /dev/ttyUSB0 - then - PORT=/dev/ttyUSB0 - fi -fi -if [ -z "$PORT" ] -then - echo "ESP likely not connected! Exiting now." - echo "Make sure the ESP is connected with a data USB cable, and try again." - exit 1 -fi -cargo espflash monitor --port $PORT +cargo espflash monitor diff --git a/sphinx-key/clear_sd.sh b/sphinx-key/clear_sd.sh index 5d0e01e..f761480 100755 --- a/sphinx-key/clear_sd.sh +++ b/sphinx-key/clear_sd.sh @@ -1,9 +1,10 @@ +#!/bin/bash + +set -e + check_exists() { command -v "$1" > /dev/null } -check_port() { - cargo espflash board-info --port "$1" &> /dev/null -} if ! check_exists esptool.py then echo "esptool.py not installed!" @@ -28,7 +29,7 @@ then echo "install with this command: cargo install espflash" exit 1 fi -cargo espflash save-image --bin clear --release --chip esp32c3 clear.bin && -espsecure.py sign_data clear.bin --version 2 --keyfile ../secure_boot_signing_key.pem && -espflash write-bin 0x50000 clear.bin && +cargo espflash save-image --bin clear --release --chip esp32c3 clear.bin +espsecure.py sign_data clear.bin --version 2 --keyfile ../secure_boot_signing_key.pem +espflash write-bin 0x50000 clear.bin cargo espflash monitor diff --git a/sphinx-key/run.sh b/sphinx-key/run.sh deleted file mode 100755 index 7617c8d..0000000 --- a/sphinx-key/run.sh +++ /dev/null @@ -1,11 +0,0 @@ -CFLAGS=-fno-pic - -CC=$PWD/.embuild/espressif/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc - -SSID=sphinx-1 PASS=sphinx-1234 cargo build --release - -esptool.py --chip esp32c3 elf2image target/riscv32imc-esp-espidf/release/sphinx-key - -esptool.py --chip esp32c3 -p /dev/tty.usbserial-1420 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x10000 target/riscv32imc-esp-espidf/release/sphinx-key.bin - -espmonitor /dev/tty.usbserial-1420 \ No newline at end of file diff --git a/sphinx-key/sphinx_key.sh b/sphinx-key/sphinx_key.sh index 595fbc5..043270b 100755 --- a/sphinx-key/sphinx_key.sh +++ b/sphinx-key/sphinx_key.sh @@ -1,3 +1,7 @@ +#!/bin/bash + +set -e + check_exists() { command -v "$1" > /dev/null } @@ -25,7 +29,7 @@ then echo "install with this command: cargo install espflash" exit 1 fi -cargo espflash save-image --bin sphinx-key --release --chip esp32c3 sphinx-key.bin && -espsecure.py sign_data sphinx-key.bin --version 2 --keyfile ../secure_boot_signing_key.pem && -espflash write-bin 0x50000 sphinx-key.bin && +cargo espflash save-image --bin sphinx-key --release --chip esp32c3 sphinx-key.bin +espsecure.py sign_data sphinx-key.bin --version 2 --keyfile ../secure_boot_signing_key.pem +espflash write-bin 0x50000 sphinx-key.bin cargo espflash monitor