/
build.sh
executable file
·105 lines (89 loc) · 3.09 KB
/
build.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
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
scriptname=`which $0`
scriptdir=`dirname $scriptname`
scriptdir=`dirname $scriptdir`
export CONNECTALDIR=`dirname $scriptdir`
echo "CONNECTALDIR=$CONNECTALDIR"
if [ "$AWS_FPGA_BUCKET" == "" ]; then
AWS_FPGA_BUCKET=aws-fpga
fi
if [ "$AWS_FPGA_REPO_DIR" == "" ]; then
if [ -d `dirname $CONNECTALDIR`/aws-fpga ]; then
pushd `dirname $CONNECTALDIR`/aws-fpga
. hdk_setup.sh
popd
fi
if [ -d ~/aws-fpga ]; then
pushd ~/aws-fpga
. hdk_setup.sh
popd
fi
fi
BUILD_DIR=`pwd`
echo BUILD_DIR=$BUILD_DIR
if [ `basename $BUILD_DIR` = 'scripts' ]; then
cd ../..
else
mkdir -p design
mkdir -p build/checkpoints/to_aws
mkdir -p build/constraints
mkdir -p build/reports
mkdir -p build/scripts
mkdir -p build/src_post_encryption
BUILD_DIR=`pwd`/build/scripts
echo BUILD_DIR=$BUILD_DIR
fi
## copy the scripts into the build directory so we don't have to worry about paths
rsync -v $CONNECTALDIR/scripts/aws/* $BUILD_DIR
if [ ! -f $CONNECTALDIR/out/awsf1/ila_connectal_1/ila_connectal_1.xci ]; then
echo
echo 'Generating Integrated Logic Analyzer core'
echo
vivado -mode batch -source $CONNECTALDIR/scripts/connectal-synth-ila.tcl
echo
echo 'Finished generating Integrated Logic Analyzer core'
echo
fi
if [ ! -f $CONNECTALDIR/out/awsf1/axi_protocol_checker_0/axi_protocol_checker_0.xci ]; then
echo
echo 'Generating AXI Protocol Checker core'
echo
vivado -mode batch -source $CONNECTALDIR/scripts/connectal-synth-axichecker.tcl
echo
echo 'Finished generating AXI Protocol Checker core'
echo
fi
export CL_DIR=`pwd`
cd $BUILD_DIR
echo CL_DIR=$CL_DIR
echo BUILD_DIR=$BUILD_DIR
cp -fv $CONNECTALDIR/verilog/cl_id_defines.vh $BUILD_DIR/../../design
echo '#placeholder' > ../constraints/cl_pnr_user.xdc
echo '#placeholder' > ../constraints/cl_synth_user.xdc
## run Vivado to build the FPGA image
$AWS_FPGA_REPO_DIR/hdk/common/shell_stable/build/scripts/aws_build_dcp_from_cl.sh -ignore_memory_requirement -strategy CONGESTION -clock_recipe_a A0 -notify -foreground
PROJECT_DIR=`dirname $CL_DIR`
PROJECT_NAME=`basename $PROJECT_DIR`
echo PROJECT_NAME=${PROJECT_NAME}
## return to $CL_DIR
cd $CL_DIR
## and now should be in awsf1 subdirectory of $PROJECT_DIR
pwd
last_log=`realpath build/scripts/last_log`
echo last_log=${last_log}
build_timestamp=`basename ${last_log} .vivado.log`
echo build_timestamp=${build_timestamp}
##
## if build completed successfully, request AWS to create an FPGA image
##
if [ -f build/checkpoints/to_aws/${build_timestamp}.Developer_CL.tar ]; then
## request AWS to create an AWS FPGA image
$CONNECTALDIR/scripts/aws/create-fpga-image.sh $PROJECT_NAME $build_timestamp $AWS_FPGA_BUCKET \
&& ( sleep 1;
## query AWS to make sure the FPGA image is building
$CONNECTALDIR/scripts/aws/describe-latest-fpga-image.sh )
fi
if [ "$EMAIL" != "" ]; then
echo "Connectal AWS FPGA: - Calling notification script to send e-mail to $EMAIL";
${CONNECTALDIR}/scripts/aws/notify_via_sns.py --build-project ${PROJECT_NAME} --filename ${filename} --timestamp ${build_timestamp} --fpga-image-ids `cat latest-fpga-image.json`
fi