Line 1... |
Line 1... |
#!/bin/bash
|
#!/bin/bash
|
# Author: Constantinos Xanthopoulos
|
# Author: Constantinos Xanthopoulos & Raul Fajardo
|
# This script install MinSOC tree
|
# This script install MinSOC tree
|
# under a specific directory.
|
# under a specific directory.
|
|
|
# ===== CONFIGURATIONS =====
|
# ===== CONFIGURATIONS =====
|
# ==========================
|
# ==========================
|
|
MINSOC_SVN_URL=http://opencores.org/ocsvn/minsoc/minsoc/trunk
|
# Where should I put the dir. minsoc?
|
export SCRIPT_DIR="$( cd -P "$( dirname "$0" )" && pwd )"
|
# ex. /home/conx/Thesis/
|
export DIR_TO_INSTALL=`pwd`
|
DIR_TO_INSTALL=`pwd`
|
|
|
|
# This variable should be set to trunk
|
|
# or to stable.
|
|
VERSION=""
|
|
|
|
# This variable should take one of
|
|
# the following values depending
|
|
# to your system: linux, cygwin, freebsd
|
|
ENV=""
|
|
|
|
# !!! DO NOT EDIT BELLOW THIS LINE !!!
|
|
# ===================================
|
|
|
|
# ===== SCRIPT ======
|
|
# ===================
|
|
|
|
|
|
# Debug ?
|
# Debug ?
|
export DEBUG=0;
|
export DEBUG=0;
|
. beautify.sh
|
. ${SCRIPT_DIR}/beautify.sh
|
|
|
function testtool
|
function testtool
|
{
|
{
|
# is_missing=`which $1 2>&1 | grep no`
|
# is_missing=`which $1 2>&1 | grep no`
|
is_missing=`whereis -b $1 2>&1 | grep :$`
|
is_missing=`whereis -b $1 2>&1 | grep :$`
|
Line 100... |
Line 83... |
cecho "${DIR_TO_INSTALL} selected";
|
cecho "${DIR_TO_INSTALL} selected";
|
fi
|
fi
|
|
|
if [ ! -d ${DIR_TO_INSTALL} ]
|
if [ ! -d ${DIR_TO_INSTALL} ]
|
then
|
then
|
errormsg "Directory doesn't exist. Please create it";
|
cecho "Directory ${DIR_TO_INSTALL} doesn't exist."
|
|
execcmd "Creating directory ${DIR_TO_INSTALL}" "mkdir -p ${DIR_TO_INSTALL}"
|
|
if [ $? -ne 0 ]
|
|
then
|
|
errormsg "Connot create ${DIR_TO_INSTALL}";
|
|
fi
|
fi;
|
fi;
|
|
|
|
|
#Creating directory structure
|
#Creating directory structure
|
cecho "\nCreating directory structure"
|
cecho "\nCreating directory structure"
|
Line 115... |
Line 103... |
|
|
#Downloading everything we need
|
#Downloading everything we need
|
cecho "\nDownloading packages"
|
cecho "\nDownloading packages"
|
cd ${DIR_TO_INSTALL}
|
cd ${DIR_TO_INSTALL}
|
cecho "Download MinSoC"
|
cecho "Download MinSoC"
|
svn co -q http://opencores.org/ocsvn/minsoc/minsoc/trunk/ minsoc #user need to input password, execcmd omits command output and should be this way
|
svn co -q ${MINSOC_SVN_URL} minsoc #user need to input password, execcmd omits command output and should be this way
|
execcmd "cd ${DIR_TO_INSTALL}/download"
|
execcmd "cd ${DIR_TO_INSTALL}/download"
|
if [ "$ENV" == "Cygwin" ]
|
if [ "$ENV" == "Cygwin" ]
|
then
|
then
|
execcmd "Downloading GNU Toolchain" "wget ftp://ocuser:ocuser@openrisc.opencores.org/toolchain/or32-elf-cygwin-1.7.tar.bz2";
|
execcmd "Downloading GNU Toolchain" "wget ftp://ocuser:ocuser@openrisc.opencores.org/toolchain/or32-elf-cygwin-1.7.tar.bz2";
|
else
|
else
|
Line 191... |
Line 179... |
|
|
execcmd "mkdir -p build"
|
execcmd "mkdir -p build"
|
execcmd "cd build"
|
execcmd "cd build"
|
execcmd "../configure --target=or32-elf --disable-werror --prefix=$DIR_TO_INSTALL/tools"
|
execcmd "../configure --target=or32-elf --disable-werror --prefix=$DIR_TO_INSTALL/tools"
|
execcmd "Compiling GDB" "make"
|
execcmd "Compiling GDB" "make"
|
make install 1>>${DIR_TO_INSTALL}/progress.log 2>>${DIR_TO_INSTALL}/error.log #avoid Fedora failing due to missing Makeinfo
|
make install 1>>${SCRIPT_DIR}/progress.log 2>>${SCRIPT_DIR}/error.log #avoid Fedora failing due to missing Makeinfo
|
PATH=$PATH:${DIR_TO_INSTALL}/tools/bin
|
PATH=$PATH:${DIR_TO_INSTALL}/tools/bin
|
|
|
|
|
#Installing Advanced JTAG Bridge support libraries
|
#Installing Advanced JTAG Bridge support libraries
|
if [ "$ENV" != "Cygwin" ]
|
if [ "$ENV" != "Cygwin" ]
|
Line 242... |
Line 230... |
execcmd "./configure --prefix=${DIR_TO_INSTALL}/tools"
|
execcmd "./configure --prefix=${DIR_TO_INSTALL}/tools"
|
execcmd "Compiling Icarus Verilog" "make"
|
execcmd "Compiling Icarus Verilog" "make"
|
execcmd "make install"
|
execcmd "make install"
|
|
|
|
|
#Configuring MinSoC
|
#Configuring MinSoC, Advanced Debug System and patching OpenRISC
|
cecho "\nConfiguring MinSoC"
|
bash ${SCRIPT_DIR}/configure.sh
|
execcmd "cd ${DIR_TO_INSTALL}/minsoc/backend/std"
|
|
execcmd "Configuring MinSoC as standard board (simulatable but not synthesizable)" "./configure"
|
|
execcmd "cd ${DIR_TO_INSTALL}"
|
|
|
|
|
|
#Configuring Advanced Debug System to work with MinSoC
|
|
cecho "\nConfiguring Advanced Debug System to work with MinSoC"
|
|
execcmd "cd ${DIR_TO_INSTALL}/minsoc/rtl/verilog/adv_debug_sys/Hardware/adv_dbg_if/rtl/verilog"
|
|
sed "s%\`define DBG_JSP_SUPPORTED%//\`define DBG_JSP_SUPPORTED%" adbg_defines.v > TMPFILE && mv TMPFILE adbg_defines.v
|
|
|
|
#Compiling and moving adv_jtag_bridge debug modules for simulation
|
|
execcmd "cd ${DIR_TO_INSTALL}/minsoc/rtl/verilog/adv_debug_sys/Software/adv_jtag_bridge/sim_lib/icarus"
|
|
execcmd "make"
|
|
execcmd "cp jp-io-vpi.vpi ${DIR_TO_INSTALL}/minsoc/bench/verilog/vpi"
|
|
|
|
|
|
#Precompiling firmwares
|
|
cecho "\nPrecompiling delivered firmwares";
|
|
execcmd "cd ${DIR_TO_INSTALL}/minsoc/sw/utils"
|
|
execcmd "Make utils" "make"
|
|
|
|
execcmd "cd ${DIR_TO_INSTALL}/minsoc/sw/support"
|
|
execcmd "Make support tools" "make"
|
|
|
|
execcmd "cd ${DIR_TO_INSTALL}/minsoc/sw/drivers"
|
|
execcmd "Make drivers" "make"
|
|
|
|
execcmd "cd ${DIR_TO_INSTALL}/minsoc/sw/uart"
|
|
execcmd "Make UART" "make"
|
|
|
|
|
|
#Setting-up new variables
|
#Setting-up new variables
|
cecho "\nSystem configurations"
|
cecho "\nSystem configurations"
|
execcmd "Adding MinSoC tools to PATH" "echo \"PATH=\\\$PATH:$DIR_TO_INSTALL/tools/bin\" >> /home/$(whoami)/.bashrc;";
|
execcmd "Adding MinSoC tools to PATH" "echo \"PATH=\\\$PATH:$DIR_TO_INSTALL/tools/bin\" >> /home/$(whoami)/.bashrc;";
|