forked from quartiq/kasli-i2c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·50 lines (40 loc) · 1.08 KB
/
deploy.sh
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
#!/bin/bash
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-d|--dir)
DIR="$2"
shift # past argument
shift # past value
;;
-v|--version)
VERSION="$2"
shift # past argument
shift # past value
;;
*)
esac
done
set -e
set -x
SERIAL=$(python3 kasli_get_mac.py)
FT_SERIAL=$SERIAL
{
IP=10.34.16.100
FT_BUS=1
FT_PORT=7.4
UART_DEV=/dev/serial/by-id/usb-ARTIQ_Sinara_Quad_RS232-HS_$FT_SERIAL-if02-port0
BUSNUM=$(cat /sys/bus/usb/devices/$FT_BUS-$FT_PORT/busnum)
DEVNUM=$(cat /sys/bus/usb/devices/$FT_BUS-$FT_PORT/devnum)
cat kasli-ft4232h.conf.in | m4 -DFT_SERIAL=$FT_SERIAL > kasli-ft4232h.conf
ftdi_eeprom --device d:$BUSNUM/$DEVNUM --flash-eeprom kasli-ft4232h.conf
sleep 3
artiq_mkfs storage.img -s ip $IP
artiq_flash -t kasli -I "ftdi_serial $FT_SERIAL" -V $VERSION --srcbuild -d $DIR -f storage.img gateware bootloader firmware storage start
stty -F $UART_DEV 115200 cs8 -cstopb -parenb opost onlcr
timeout --foreground 15 socat stdio $UART_DEV || true
sudo ip neigh flush to $IP || true
ping -w40 -W40 -c4 $IP
echo SUCCESS
} 2>&1 | tee deploy_$FT_SERIAL.log