-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_bsp.sh
94 lines (82 loc) · 2.33 KB
/
build_bsp.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
set -x
if [ -z "${HDLBRANCH}" ]; then
HDLBRANCH='master'
fi
# Script is designed to run from specific location
scriptdir=`dirname "$BASH_SOURCE"`
cd $scriptdir
cd ..
# Get HDL
if [ -d "hdl" ]; then
rm -rf "hdl"
fi
for i in {1..5}
do
if git clone --single-branch -b $HDLBRANCH https://github.com/analogdevicesinc/hdl.git
then
break
fi
if [ -d "hdl" ]; then
break
fi
done
if [ ! -d "hdl" ]; then
echo "HDL clone failed"
exit 1
fi
# Get required vivado version needed for HDL
if [ -f "hdl/library/scripts/adi_ip.tcl" ]; then
TARGET="hdl/library/scripts/adi_ip.tcl"
else
TARGET="hdl/library/scripts/adi_ip_xilinx.tcl"
fi
VER=$(awk '/set required_vivado_version/ {print $3}' $TARGET | sed 's/"//g')
echo "Required Vivado version ${VER}"
VIVADOFULL=${VER}
if [ ${#VER} = 8 ]
then
VER=${VER:0:6}
fi
VIVADO=${VER}
# Setup
source /opt/Xilinx/Vivado/$VIVADO/settings64.sh
# Pre-build IP library
# cd hdl/library
# make
# cd ../..
# Rename .prj files since MATLAB ignores then during packaging
FILES=$(grep -lrn hdl/projects/common -e '.prj' | grep -v Makefile | grep -v .git)
for f in $FILES
do
echo "Updating prj reference in: $f"
sed -i "s/\.prj/\.mk/g" "$f"
done
FILES=$(find hdl/projects/common -name "*.prj")
for f in $FILES
do
DEST="${f::-3}mk"
echo "Renaming: $f to $DEST"
mv "$f" "$DEST"
done
# Remove git directory move to bsp folder
rm -fr hdl/.git*
TARGET="../hdl/vendor/AnalogDevices/vivado"
if [ -d "$TARGET" ]; then
rm -rf "$TARGET"
fi
# Increase rx_clk period to fix timing failures for Pluto designs in R2021b
sed -i 's/16.27/30/' hdl/projects/pluto/system_constr.xdc
mv hdl $TARGET
# Post-process ports.json
cp ./scripts_hdl/ports.json ./
python3 ./scripts/read_ports_json.py
cp ports.json ../hdl/vendor/AnalogDevices/+AnalogDevices/
# Updates
cp scripts_hdl/matlab_processors.tcl ../hdl/vendor/AnalogDevices/vivado/projects/scripts/matlab_processors.tcl
cp scripts/system_project_rxtx.tcl ../hdl/vendor/AnalogDevices/vivado/projects/scripts/system_project_rxtx.tcl
cp scripts/adi_build.tcl ../hdl/vendor/AnalogDevices/vivado/projects/scripts/adi_build.tcl
# Copy boot files
mkdir ../hdl/vendor/AnalogDevices/vivado/projects/common/boot/
cp -r scripts/boot/* ../hdl/vendor/AnalogDevices/vivado/projects/common/boot/
echo 'puts "Skipping"' > ../hdl/vendor/AnalogDevices/vivado/library/axi_ad9361/axi_ad9361_delay.tcl