mirror of
https://github.com/bmartini/zynq-axis.git
synced 2024-09-05 19:19:27 +08:00
c30562deec
Some projects will name the bitstream files a standard name and thus by renaming them we can ensure that the bitstream files are easily identified after syntheses.
87 lines
1.4 KiB
Bash
Executable File
87 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -o errexit
|
|
|
|
|
|
function print_usage() {
|
|
echo "
|
|
Usage: $0 [OPTION] [project-name]
|
|
|
|
Description: Synthesize a project in scratch & produce bitfile.
|
|
|
|
Options:
|
|
-h Print this help info.
|
|
|
|
-s Synthesize only. Assumes that the 'syn-proj-prep' script has already
|
|
been run.
|
|
|
|
Argument:
|
|
The 'project-name' is an optional argument that will select which
|
|
project to synthesize. Without the argument the default
|
|
project-zedboard-conv' is used.
|
|
"
|
|
}
|
|
|
|
|
|
flag_s=
|
|
|
|
# command line options
|
|
while getopts "hs" flag
|
|
do
|
|
case "$flag" in
|
|
s) flag_s=1;;
|
|
h) print_usage; exit 2;;
|
|
?) print_usage; exit 2;;
|
|
esac
|
|
done
|
|
|
|
|
|
# default project selection
|
|
PROJ='project-zedboard_axis'
|
|
|
|
|
|
# sanitise project argument
|
|
shift $(($OPTIND - 1))
|
|
if [ $# -gt 1 ]
|
|
then :
|
|
echo "ERROR: To many arguments"
|
|
exit 1
|
|
elif [ ! -d "syn/$@" ]
|
|
then :
|
|
echo "ERROR: Project not found"
|
|
exit 1
|
|
fi
|
|
|
|
|
|
# assign project if given as argument
|
|
if [[ ! -z "$@" && "$@" != "$PROJ" ]]
|
|
then :
|
|
PROJ=$@
|
|
fi
|
|
|
|
|
|
# prep for project syntheses
|
|
if [ -z "$flag_s" ]
|
|
then :
|
|
./syn-proj-prep
|
|
fi
|
|
|
|
if [ ! -d syn/scratch ]
|
|
then :
|
|
echo "ERROR: No 'syn/scratch' directory found"
|
|
exit 1
|
|
fi
|
|
|
|
|
|
if [ -z "$(command -v vivado)" ]; then
|
|
echo "ERROR: No Xilinx tool has been sourced."
|
|
exit 1
|
|
fi
|
|
|
|
# generate the bitfile using Xilinx tools
|
|
cd syn/scratch/
|
|
vivado -mode tcl -source $PROJ/generate-bitfile.tcl
|
|
|
|
|
|
# copy bitfile to repo root
|
|
find ./$PROJ -name "*.bit" | xargs -I F cp F ../../${PROJ#"project-"}.bit
|