diff options
-rw-r--r-- | fpga/usrp3/tools/scripts/setupenv_base.sh | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/fpga/usrp3/tools/scripts/setupenv_base.sh b/fpga/usrp3/tools/scripts/setupenv_base.sh index 76385c598..5919b3aa8 100644 --- a/fpga/usrp3/tools/scripts/setupenv_base.sh +++ b/fpga/usrp3/tools/scripts/setupenv_base.sh @@ -38,6 +38,31 @@ function resolve_viv_path { } #---------------------------------------------------------------------------- +# Help message display function +#---------------------------------------------------------------------------- +function setupenv_help { + cat <<EOHELP + +Usage: source setupenv.sh [--help|-h] [--vivado-path=<PATH>] [--modelsim-path=<PATH>] + +--vivado-path : Path to the base install directory for Xilinx Vivado + (Default: /opt/Xilinx/Vivado or /opt/Xilinx/Vivado_Lab) +--modelsim-path : Path to the base install directory for Modelsim (optional simulation tool) + (Default: /opt/mentor/modelsim) +--help -h : Shows this message. + +This script sets up the environment required to build FPGA images for the Ettus Research +${DISPLAY_NAME}. It will also optionally set up the the environment to run the +Modelsim simulator (although this tool is not required). + +Required tools: Xilinx Vivado $VIVADO_VER (Synthesis and Simulation) +Optional tools: Mentor Graphics Modelsim (Simulation) + +EOHELP +} + + +#---------------------------------------------------------------------------- # Validate prerequisites #---------------------------------------------------------------------------- # Ensure required variables @@ -58,38 +83,15 @@ if [ ${#PRODUCT_ID_MAP[@]} -eq 0 ]; then return fi -# Ensure that the script is sourced -if [[ $BASH_SOURCE = $0 ]]; then +# Ensure that the script is sourced directly or from another script, and not +# executed. +if [[ ${BASH_SOURCE[0]} == "$0" || ${BASH_SOURCE[1]} == "$0" ]]; then echo "ERROR: This script must be sourced." - help + setupenv_help exit 1 fi #---------------------------------------------------------------------------- -# Help message display function -#---------------------------------------------------------------------------- -function help { - cat <<EOHELP - -Usage: source setupenv.sh [--help|-h] [--vivado-path=<PATH>] [--modelsim-path=<PATH>] - ---vivado-path : Path to the base install directory for Xilinx Vivado - (Default: /opt/Xilinx/Vivado or /opt/Xilinx/Vivado_Lab) ---modelsim-path : Path to the base install directory for Modelsim (optional simulation tool) - (Default: /opt/mentor/modelsim) ---help -h : Shows this message. - -This script sets up the environment required to build FPGA images for the Ettus Research -${DISPLAY_NAME}. It will also optionally set up the the environment to run the -Modelsim simulator (although this tool is not required). - -Required tools: Xilinx Vivado $VIVADO_VER (Synthesis and Simulation) -Optional tools: Mentor Graphics Modelsim (Simulation) - -EOHELP -} - -#---------------------------------------------------------------------------- # Setup and parse command line #---------------------------------------------------------------------------- # Detect platform bitness @@ -106,7 +108,7 @@ PARSE_STATE="" for i in "$@"; do case $i in -h|--help) - help + setupenv_help return 0 ;; --vivado-path=*) @@ -148,7 +150,7 @@ for i in "$@"; do ;; *) echo "ERROR: Unrecognized option: $i" - help + setupenv_help return 1 ;; esac |