-
Notifications
You must be signed in to change notification settings - Fork 6
/
update_xous.sh
executable file
·67 lines (59 loc) · 1.5 KB
/
update_xous.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
UPDATE_FPGA=1
UPDATE_KERNEL=1
UPDATE_LOADER=1
SKIP_PROMPT=0
for arg in "$@"
do
case $arg in
-k|--kernel-skip)
UPDATE_KERNEL=0
shift
;;
-l|--loader-skip)
UPDATE_LOADER=0
shift
;;
-f|--fpga-skip)
UPDATE_FPGA=0
shift
;;
-h|--help)
echo "$0 writes update binaries. --kernel-skip skips the kernel, --fpga-skip skips the FPGA, --loader-skip skips the loader."
exit 0
;;
--key)
shift
KEY="--key $1"
shift
;;
*)
OTHER_ARGUMENTS+=("$1")
shift
;;
esac
done
md5sum ../precursors/soc_csr.bin
md5sum ../precursors/loader.bin
md5sum ../precursors/xous.img
# ensure that the power is on, this is a footgun for new users
sudo ./vbus.sh 1
sudo ./reset_soc.sh
if [ $UPDATE_LOADER -eq 1 ]
then
cd jtag-tools && ./jtag_gpio.py -f ../../precursors/loader.bin --raw-binary -a 0x500000 -s -r -n $KEY
cd ..
fi
if [ $UPDATE_KERNEL -eq 1 ]
then
cd jtag-tools && ./jtag_gpio.py -f ../../precursors/xous.img --raw-binary -a 0x980000 -s -r -n $KEY
cd ..
fi
if [ $UPDATE_FPGA -eq 1 ]
then
cd jtag-tools && ./jtag_gpio.py -f ../../precursors/soc_csr.bin --raw-binary -a 0x280000 --spi-mode -r -n $KEY
cd ..
echo "Gateware update staged. To apply, select 'Install gateware update' from the root menu of your device."
echo "If you have not initialized root keys yet, use provision_xous.sh instead to directly overwrite the image. This deletes any keys and replaces them with defaults."
fi
sudo ./reset_soc.sh