forked from Blockstream/Jade
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathci_flash.sh
More file actions
executable file
·55 lines (45 loc) · 1.58 KB
/
ci_flash.sh
File metadata and controls
executable file
·55 lines (45 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
set -eo pipefail
if [[ -z ${JADESERIALPORT} ]]; then
echo "JADESERIALPORT not set, defaulting..."
if [ "$(uname)" == "Darwin" ]; then
JADESERIALPORT=/dev/cu.SLAB_USBtoUART
elif [ -c /dev/ttyUSB0 ]; then
JADESERIALPORT=/dev/ttyUSB0
else
JADESERIALPORT=/dev/ttyACM0
fi
fi
echo "Using JADESERIALPORT ${JADESERIALPORT}"
TARGET_CHIP=${1}
SKIP_ARGS=${2}
if [ -z "$IDF_PATH" ]; then
get_idf
fi
./tools/initial_flash_${TARGET_CHIP}.sh ${JADESERIALPORT}
sleep 1
if [ -f /.dockerenv ]; then
# Running under docker/the CI: main requirements are
# already installed into the idf environment.
# Just install the pinserver requirements
pip install -r pinserver/requirements.txt
else
# Running locally: set up a virtualenv
virtualenv -p python3 venv3
source venv3/bin/activate
pip install --require-hashes -r requirements.txt
pip install -r pinserver/requirements.txt
fi
if [ ! -x /usr/bin/bt-agent ]; then
echo "bt-agent not available, skipping bluetooth OTA"
SKIP_ARGS="--skipble"
fi
# NOTE: tools/fwprep.py should have run in the build step and produced the compressed firmware file
FW_FULL=$(ls build/*_fw.bin)
python jade_ota.py --push-mnemonic --log=INFO --serialport=${JADESERIALPORT} --fwfile=${FW_FULL} ${SKIP_ARGS}
sleep 5
python -c "from jadepy import JadeAPI; jade = JadeAPI.create_serial(device=\"${JADESERIALPORT}\", timeout=5) ; jade.connect(); jade.drain(); jade.disconnect()"
python test_jade.py --log=INFO --serialport=${JADESERIALPORT} ${SKIP_ARGS}
if [ ! -f /.dockerenv ]; then
deactivate
fi