-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathinit_params.sh
executable file
·73 lines (61 loc) · 2.04 KB
/
init_params.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
68
69
70
71
72
73
#!/usr/bin/env bash
# Given the Xilinx FPGA part number, this finds the appropriate FPGA family,
# which is appended to the provided configFile
echo $configFile
if [[ "$#" != 1 && "$#" != 5 && "$#" != 7 && "$#" != 9 && "$#" != 10 ]]; then
echo "5,7 or 8 arguments expected, got $#"
echo "Usage: init.sh /abs/path/to/galapagos/repository /abs/path/to/vitis /abs/path/to/vitis_hls vitis_version vitis_hls_version [part name] [board name] [board] "
echo "Usage: source init.sh OPERATION"
return 1
fi
if [[ "$#" != 1 ]]; then
repoPath=$(readlink -f "$1")
vitisPath=$(readlink -f "$2")
hlsPath=$(readlink -f "$3")
echo $vitisPath
vitisVersion=$4
hlsVersion=$5
fi
# TODO prefix all "shells" with galapagos_
configFile=~/.galapagos
if [[ "$#" == 1 ]]; then
if [[ $operation == "switch" ]]; then
unset "${!GALAPAGOS@}"
sed -i '/# added by galapagos/s/^/#/' ~/.bashrc
sed -i '/# added by shells/s/^#//' ~/.bashrc
source $configFile
return 0
else
echo "Unknown operation: $operation"
return 1
fi
fi
if [[ -f $configFile ]]; then
echo "Updating galapagos initialization..."
unset GALAPAGOS_BOARD
rm $configFile
fi
# TODO make versions into a list and print supported versions on 'else' path
hlsPath_append=$hlsPath/$hlsVersion
if [[ "$#" > 5 ]]; then
# https://stackoverflow.com/a/2264537
part=$(echo "$part" | tr '[:upper:]' '[:lower:]') # convert to lower-case
find_family $configFile $part
if [[ $? != 0 ]]; then
echo "Error $?: Unable to identify FPGA family from part $part"
return 1
fi
fi
vitisPath_append=$vitisPath/$vitisVersion
interfaceBandwidth="100G"
{
echo "export GALAPAGOS_PATH=$repoPath"
echo "export GALAPAGOS_VITIS_PATH=$vitisPath_append"
echo "export GALAPAGOS_HLS_PATH=$hlsPath_append"
echo "export GALAPAGOS_VITIS_VERSION=$vitisVersion"
echo "export GALAPAGOS_HLS_VERSION=$hlsVersion"
echo "source $vitisPath_append/settings64.sh"
echo "export GALAPAGOS_BANDWIDTH=$interfaceBandwidth" >> $configFile
} >> $configFile
source $configFile
export PATH=$vitisPath_append/bin:$PATH