OpenCores
URL https://opencores.org/ocsvn/radiohdl/radiohdl/trunk

Subversion Repositories radiohdl

[/] [radiohdl/] [trunk/] [quartus/] [run_sopc] - Rev 4

Compare with Previous | Blame | View Log

#!/bin/bash -eu
# -------------------------------------------------------------------------- #
#
# Copyright (C) 2010                                                        
# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
# JIVE (Joint Institute for VLBI in Europe) <http://www.jive.nl/>           
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands                             
#                                                                           
# This program is free software: you can redistribute it and/or modify      
# it under the terms of the GNU General Public License as published by      
# the Free Software Foundation, either version 3 of the License, or         
# (at your option) any later version.                                       
#                                                                           
# This program is distributed in the hope that it will be useful,           
# but WITHOUT ANY WARRANTY; without even the implied warranty of            
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             
# GNU General Public License for more details.                              
#                                                                           
# You should have received a copy of the GNU General Public License         
# along with this program.  If not, see <http://www.gnu.org/licenses/>.     
#
# -------------------------------------------------------------------------- #

# Run this tool with at least the commandline arguments:
#   run_sopc buildset design_name
# example:
#   run_sopc unb1 unb1_minimal

# read generic functions/definitions
. ${RADIOHDL_GEAR}/generic.sh

if [ $# -ne 2 ] && [ $# -ne 3 ]; then
    hdl_error $0 "Syntax: $0 <buildset> <project> [<sopcfile>]"
fi

buildset=$1
project=$2
sopcfile=${3:+$3}

# read in the configuration based on the user arguments
. ${RADIOHDL_GEAR}/quartus/set_quartus ${buildset}

# search for existing project directory
PRJS="${RADIOHDL_BUILD_DIR}"
PRJ=
for prj in ${PRJS}
    do
        if [ -d "${prj}/${buildset}/quartus/${project}" ]; then
            PRJ=${prj}
        fi  
    done  
if [ -z "${project}" -o -z "${PRJ}" ]; then
    hdl_error $0 "Please enter a valid project name"
fi

# Form name of quartusdir and check if it indeed exists
quartusdir="${PRJ}/${buildset}/quartus/${project}"
hdl_exec $0 msg=no test -d ${quartusdir}

# The SOPC file is optional. If it is omitted choose the first
# one we find. Let user know we do this
set +e
if [ -z "${sopcfile}" ]; then
    sopcfile=$(ls ${quartusdir}/*sopc 2>/dev/null | sed -n 1p)
    if [ -z "${sopcfile}" ]; then
        hdl_error $0 "No SOPC files found in ${quartusdir}"
    fi
fi 
set -e
sopcfile=`basename ${sopcfile}`
sopcfilebase=`basename ${sopcfile} .sopc`
if [ "${3:+$3}" != "${sopcfile}" ]; then
    hdl_info $0 "SELECTING DEFAULT SOPC FILE ${sopcfile} (${sopcfilebase})"
fi
if [ ! -f "${quartusdir}/${sopcfile}" ]; then
    hdl_error $0 "SOPC file '${sopcfile}' not found in ${quartusdir}"
fi


# Great. Having asserted our preconditions, let's do it!
# note: we want hdl_exec to display a slightly different msg
#       AND sopc_builder returns exitcode 4 on succesfull completion
#           rather than the standard 0 ...
cd ${quartusdir}
txt="Generating SOPC system for project ${project}."
hdl_exec $0 msg="${txt}" expect=4 sopc_builder --generate=1 ${sopcfile}

hdl_info $0 "SOPC generated successfully."

# Additionally build the UNBOS App here as well:
. ${RADIOHDL_GEAR}/set_hdllib_variable ${buildset} ${project} nios2_app_userflags
if [ -n "${nios2_app_userflags}" ]; then
    hdl_info $0 "Additionally building the UNBOS App."
    ${RADIOHDL_GEAR}/quartus/run_app_clean ${buildset} ${project}
    ${RADIOHDL_GEAR}/quartus/run_app ${buildset} ${project} --userflags=${nios2_app_userflags}
fi

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.