1 |
4 |
danv |
#!/bin/bash -eu
|
2 |
|
|
###############################################################################
|
3 |
|
|
#
|
4 |
|
|
# Copyright (C) 2014-2018
|
5 |
|
|
# ASTRON (Netherlands Institute for Radio Astronomy)
|
6 |
|
|
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
|
7 |
|
|
#
|
8 |
|
|
# This program is free software: you can redistribute it and/or modify
|
9 |
|
|
# it under the terms of the GNU General Public License as published by
|
10 |
|
|
# the Free Software Foundation, either version 3 of the License, or
|
11 |
|
|
# (at your option) any later version.
|
12 |
|
|
#
|
13 |
|
|
# This program is distributed in the hope that it will be useful,
|
14 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
# GNU General Public License for more details.
|
17 |
|
|
#
|
18 |
|
|
# You should have received a copy of the GNU General Public License
|
19 |
|
|
# along with this program. If not, see .
|
20 |
|
|
#
|
21 |
|
|
# $Id$
|
22 |
|
|
#
|
23 |
|
|
###############################################################################
|
24 |
|
|
|
25 |
|
|
# does user wants feedback on what is happening?
|
26 |
|
|
if [ "${1:-}" == "--verbose" ]; then
|
27 |
|
|
verbose=$1
|
28 |
|
|
shift
|
29 |
|
|
else
|
30 |
|
|
verbose=""
|
31 |
|
|
fi
|
32 |
|
|
|
33 |
|
|
# read generic functions
|
34 |
|
|
. ${RADIOHDL_GEAR}/generic.sh
|
35 |
|
|
|
36 |
|
|
# Buildset settings for selected a target, e.g.: "unb1", or "unb2"
|
37 |
|
|
buildset=${1:-}
|
38 |
|
|
if [ "${buildset}" = "" ]; then
|
39 |
|
|
hdl_error $0 "Please specify all arguments\nUsage: $0 "
|
40 |
|
|
fi
|
41 |
|
|
|
42 |
|
|
export BUILDSET=${buildset}
|
43 |
|
|
|
44 |
|
|
# Select output directory for the library compilation results
|
45 |
|
|
buildset_config_file="${RADIOHDL_CONFIG}/hdl_buildset_${buildset}.cfg"
|
46 |
|
|
if [ ! -f $buildset_config_file ]; then
|
47 |
|
|
hdl_error $0 "File '$buildset_config_file' does not exist"
|
48 |
|
|
fi
|
49 |
|
|
. ${RADIOHDL_GEAR}/set_config_variable $verbose $buildset_config_file synth_tool_name,synth_tool_version,block_design_names
|
50 |
|
|
|
51 |
|
|
echo "Setting up quartus for: ${buildset}"
|
52 |
|
|
|
53 |
|
|
# Adopt buildset dependend directories
|
54 |
|
|
. ${RADIOHDL_GEAR}/set_config_variable $verbose $buildset_config_file ${SYNTH_TOOL_NAME}_dir
|
55 |
|
|
|
56 |
|
|
# Adopt quartus installation dependend directories
|
57 |
|
|
quartus_config_file="${RADIOHDL_CONFIG}/hdl_tool_quartus.cfg"
|
58 |
|
|
. ${RADIOHDL_GEAR}/set_config_variable $verbose $quartus_config_file quartus_rootdir,quartus_rootdir_override,niosdir
|
59 |
|
|
|
60 |
|
|
# Extend the PATH for quartus
|
61 |
|
|
. ${RADIOHDL_GEAR}/set_config_path $verbose $quartus_config_file quartus_paths
|
62 |
|
|
|
63 |
|
|
# Extend the PATH with the block-design related and user (free defined) paths
|
64 |
|
|
for bd_name in $BLOCK_DESIGN_NAMES "user"
|
65 |
|
|
do
|
66 |
|
|
. ${RADIOHDL_GEAR}/set_config_path $verbose $quartus_config_file ${bd_name}_paths
|
67 |
|
|
done
|
68 |
|
|
|
69 |
|
|
# Adopt block-design related and user (free defined) environment variables
|
70 |
|
|
for bd_name in $BLOCK_DESIGN_NAMES "user"
|
71 |
|
|
do
|
72 |
|
|
. ${RADIOHDL_GEAR}/set_config_variable $verbose $quartus_config_file ${bd_name}_environment_variables --is-group --optional
|
73 |
|
|
done
|
74 |
|
|
|
75 |
|
|
# TODO: move to hdl_tool_quartus.cfg : user_environment_variables ???
|
76 |
|
|
# HDL_GIT_REVISION (first 32 digits of full 40-digits hash) is used in firmware
|
77 |
|
|
# HDL_GIT_REVISION_SHORT (first 9 digits of full hash) is used in file-naming
|
78 |
|
|
if [[ -n "${RADIOHDL_WORK}" ]]; then
|
79 |
|
|
git_rev=`cd $RADIOHDL_WORK; git rev-parse HEAD; cd -`
|
80 |
|
|
export HDL_GIT_REVISION=${git_rev}
|
81 |
|
|
export HDL_GIT_REVISION_SHORT=${git_rev:0:9}
|
82 |
|
|
#export HDL_GIT_REVISION=1010101
|
83 |
|
|
#export HDL_GIT_REVISION_SHORT=101
|
84 |
|
|
echo "set GIT revision to '${HDL_GIT_REVISION}' and as short '${HDL_GIT_REVISION_SHORT}'"
|
85 |
|
|
else
|
86 |
|
|
echo "GIT revision not set (RADIOHDL_WORK not available), run first '. ./init_hdl.sh' in hdl dir"
|
87 |
|
|
fi
|
88 |
|
|
export UNB_COMPILE_STAMPS=1
|
89 |
|
|
|
90 |
|
|
unset buildset_config_file quartus_config_file bd_name verbose git_rev
|