Skip to content

Commit 52fe66e

Browse files
fallensbourdeauducq
authored andcommittedApr 16, 2015
artiq_flash.sh: improve detection of flash proxy location
Flash proxy is now searched in ~/.migen /usr/local/share/migen /usr/share/migen and in the directory specified by "-d" argument or in artiq/binaries/<board_name>/ if "-d" is not specified.
1 parent 6a5f58e commit 52fe66e

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed
 

Diff for: ‎artiq/frontend/artiq_flash.sh

+30-20
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,30 @@ do
5959
esac
6060
done
6161

62+
function search_for_proxy()
63+
{
64+
PROXY=$1 # The proxy name
65+
if [ -f $HOME/.migen/$PROXY ]
66+
then
67+
PROXY_PATH=$HOME/.migen/
68+
elif [ -f /usr/local/share/migen/$PROXY ]
69+
then
70+
PROXY_PATH=/usr/local/share/migen/
71+
elif [ -f /usr/share/migen/$PROXY ]
72+
then
73+
PROXY_PATH=/usr/share/migen/
74+
elif [ -f $BIN_PREFIX/$PROXY ]
75+
then
76+
PROXY_PATH=$BIN_PREFIX
77+
else
78+
echo "$BOARD flash proxy ($PROXY) not found."
79+
echo "Please put it in ~/.migen or /usr/local/share/migen or /usr/share/migen"
80+
echo "To get the flash proxy, follow the \"Install the required flash proxy bitstreams:\""
81+
echo "bullet point from http://m-labs.hk/artiq/manual/installing.html#preparing-the-core-device-fpga-board"
82+
exit 1
83+
fi
84+
}
85+
6286
if ! [ -z "$BIN_PATH" ]
6387
then
6488
BIN_PREFIX=$BIN_PATH
@@ -70,44 +94,30 @@ then
7094
BITSTREAM=artiq_ppro-up-papilio_pro.bin
7195
CABLE=papilio
7296
PROXY=bscan_spi_lx9_papilio.bit
73-
BIN_PREFIX=$ARTIQ_PREFIX/binaries/ppro
74-
PROXY_PATH=$BIN_PREFIX
7597
BIOS_ADDR=0x60000
7698
RUNTIME_ADDR=0x70000
99+
if [ -z "$BIN_PREFIX" ]; then BIN_PREFIX=$ARTIQ_PREFIX/binaries/ppro; fi
100+
search_for_proxy $PROXY
77101
elif [ "$BOARD" == "pipistrello" ]
78102
then
79103
UDEV_RULES=99-ppro.rules
80104
BITSTREAM=artiq_pipistrello-amp-pipistrello.bin
81105
CABLE=papilio
82106
PROXY=bscan_spi_lx9_csg324.bit
83-
BIN_PREFIX=$ARTIQ_PREFIX/binaries/pipistrello
84-
PROXY_PATH=$BIN_PREFIX
85107
BIOS_ADDR=0x170000
86108
RUNTIME_ADDR=0x180000
109+
if [ -z "$BIN_PREFIX" ]; then BIN_PREFIX=$ARTIQ_PREFIX/binaries/pipistrello; fi
110+
search_for_proxy $PROXY
87111
elif [ "$BOARD" == "kc705" ]
88112
then
89113
UDEV_RULES=99-kc705.rules
90114
BITSTREAM=artiq_kc705-artiqsocbasic-kc705.bit
91115
CABLE=jtaghs1_fast
92116
PROXY=bscan_spi_kc705.bit
93-
BIN_PREFIX=$ARTIQ_PREFIX/binaries/kc705
94117
BIOS_ADDR=0xaf0000
95118
RUNTIME_ADDR=0xb00000
96-
if [ -f $HOME/.migen/$PROXY ]
97-
then
98-
PROXY_PATH=$HOME/.migen/
99-
elif [ -f /usr/local/share/migen/$PROXY ]
100-
then
101-
PROXY_PATH=/usr/local/share/migen/
102-
elif [ -f /usr/share/migen/$PROXY ]
103-
then
104-
PROXY_PATH=/usr/share/migen/
105-
else
106-
echo "KC705 flash proxy ($PROXY) not found."
107-
echo "Please build it from https://github.com/m-labs/bscan_spi_kc705"
108-
echo "and put it in ~/.migen or /usr/local/share/migen or /usr/share/migen"
109-
exit 1
110-
fi
119+
if [ -z "$BIN_PREFIX" ]; then BIN_PREFIX=$ARTIQ_PREFIX/binaries/kc705; fi
120+
search_for_proxy $PROXY
111121
fi
112122

113123
# Check if neither of -b|-B|-r have been used

0 commit comments

Comments
 (0)
Please sign in to comment.