build: use set -e to interrupt scripts on first failure

This commit is contained in:
irriden
2023-12-02 01:49:57 +00:00
parent 6eb337630d
commit 7a1dca6f35
5 changed files with 30 additions and 55 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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