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

Subversion Repositories minsoc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /minsoc/trunk/utils
    from Rev 79 to Rev 81
    Reverse comparison

Rev 79 → Rev 81

/setup/beautify.sh
5,16 → 5,19
function cecho
{
echo -e "\033[1m\033[33m$1\033[0m"
echo -e "\033[1m\033[33m$1\033[0m" >> ${DIR_TO_INSTALL}/progress.log
}
 
function cnecho
{
echo -e -n "\033[0m\033[33m$1\033[0m"
echo -e -n "\033[0m\033[33m$1\033[0m" >> ${DIR_TO_INSTALL}/progress.log
}
 
function errormsg
{
echo -e "\033[1m\033[31mError: $1\033[0m\n";
echo -e "\033[1m\033[31mError: $1\033[0m\n" >> ${DIR_TO_INSTALL}/error.log
exit 1;
}
 
21,11 → 24,15
function _execcmd
{
# Print Message
echo -e "\033[35m$1\033[0m"
echo -e "\033[35m$1...\033[0m\n" >> ${DIR_TO_INSTALL}/progress.log
if [ -n "$1" ]
then
echo -e -n "\033[35m$1...\033[0m"
fi
# Execute command
if [ $DEBUG -ne 1 ];
then
eval $2 1>/dev/null;
eval $2 1>>${DIR_TO_INSTALL}/progress.log 2>>${DIR_TO_INSTALL}/error.log;
fi;
# Check Execution
if [ $? -eq 0 ]
32,12 → 39,12
then
if [ -n "$1" ]
then
echo -e "\033[32mSuccessfully \"$1\"\033[0m\n";
echo -e "\033[32mcomplete\033[0m";
echo -e "\033[32mcomplete\033[0m" >> ${DIR_TO_INSTALL}/progress.log
fi
else
errormsg "Command: $2 Description: $1";
exit 1;
 
fi
}
 
/setup/minsoc-install.sh
48,36 → 48,7
errormsg "You shouldn't be root for this script to run.";
fi;
 
# Wizard
if [ -z "${ALTDIR}" ]
then
cnecho "Give full path (ex. /home/foo/) for installation directory or leave empty for "${DIR_TO_INSTALL}": ";
read ALTDIR;
if [ ! -z "${ALTDIR}" ]
then
DIR_TO_INSTALL=${ALTDIR}
fi
cecho "${DIR_TO_INSTALL} selected";
fi
 
# Directory exists?
if [ ! -d ${DIR_TO_INSTALL} ]
then
errormsg "Directory doesn't exist. Please create it";
fi;
 
cd ${DIR_TO_INSTALL}
 
 
#setting environment
ENV=`uname -o`
if [ "$ENV" != "GNU/Linux" ] && [ "$ENV" != "Cygwin" ]
then
errormsg "Environment $ENV not supported by this script."
fi
cecho "Building tools for ${ENV} system"
 
 
# Testing necessary tools
cecho "Testing if necessary tools are installed, program "whereis" is required."
testtool wget
97,65 → 68,32
fi
 
 
# Which Version?
if [ -z ${VERSION} ]
# Wizard
if [ -z "${ALTDIR}" ]
then
while [ "$VERSION" != "trunk" -a "$VERSION" != "stable" ]
do
cnecho "Select MinSOC Version [stable/trunk]: "
read VERSION;
done
cnecho "Give full path (ex. /home/foo/) for installation directory or leave empty for "${DIR_TO_INSTALL}": ";
read ALTDIR;
if [ ! -z "${ALTDIR}" ]
then
DIR_TO_INSTALL=${ALTDIR}
fi
cecho "${DIR_TO_INSTALL} selected";
fi
 
 
# Checkout MinSOC
if [ "${VERSION}" = "trunk" ]
if [ ! -d ${DIR_TO_INSTALL} ]
then
execcmd "Download minsoc" "svn co -q http://opencores.org/ocsvn/minsoc/minsoc/trunk/ minsoc"
execcmd "cd minsoc/backend/std"
execcmd "Selecting standard configuration (not synthesizable)" "./configure"
execcmd "cd ${DIR_TO_INSTALL}"
else
execcmd "Download minsoc" "svn co -q http://opencores.org/ocsvn/minsoc/minsoc/tags/release-0.9/ minsoc"
execcmd "cd minsoc/rtl/verilog"
errormsg "Directory doesn't exist. Please create it";
fi;
 
execcmd "Checkout adv_jtag_bridge" "svn co -q http://opencores.org/ocsvn/adv_debug_sys/adv_debug_sys/trunk adv_debug_sys"
execcmd "Checkout ethmac" "svn co -q http://opencores.org/ocsvn/ethmac/ethmac/trunk ethmac"
execcmd "Checkout openrisc" "svn co -q http://opencores.org/ocsvn/openrisc/openrisc/trunk/or1200 or1200"
execcmd "Checkout uart" "svn co -q http://opencores.org/ocsvn/uart16550/uart16550/trunk uart16550"
fi
 
 
#Tools directory
if [ ! -d ${DIR_TO_INSTALL}/tools ]
#Setting environment
ENV=`uname -o`
if [ "$ENV" != "GNU/Linux" ] && [ "$ENV" != "Cygwin" ]
then
execcmd "mkdir tools"
fi;
errormsg "Environment $ENV not supported by this script."
fi
cecho "Building tools for ${ENV} system"
 
 
#Installing GDB
execcmd "cd ${DIR_TO_INSTALL}/tools"
execcmd "Downloading GDB sources" "wget ftp://anonymous:anonymous@ftp.gnu.org/gnu/gdb/gdb-6.8.tar.bz2"
execcmd "Downloading GDB OpenRISC patch" "wget ftp://ocuser:ocuser@openrisc.opencores.org/toolchain/or32-gdb-6.8-patch-2.4.bz2"
execcmd "Downloading GDB Advanced Debug System patch" "svn export -q http://opencores.org/ocsvn/adv_debug_sys/adv_debug_sys/trunk/Patches/GDB6.8/gdb-6.8-bz436037-reg-no-longer-active.patch"
 
execcmd "Uncompressing GDB" "tar -jxf gdb-6.8.tar.bz2"
execcmd "bzip2 -d or32-gdb-6.8-patch-2.4.bz2"
execcmd "cd gdb-6.8"
execcmd "Patching GDB" "patch -p1 < ../or32-gdb-6.8-patch-2.4"
execcmd "patch -p1 < ../gdb-6.8-bz436037-reg-no-longer-active.patch"
 
execcmd "Compiling GDB" "mkdir b-gdb"
execcmd "cd b-gdb"
execcmd "../configure --target=or32-elf --disable-werror --prefix=$DIR_TO_INSTALL/tools"
execcmd "make"
make install #avoid Fedora failing due to missing Makeinfo
PATH=$PATH:$DIR_TO_INSTALL/tools/bin
 
 
# Installing the GNU Toolchain
cecho "Installing the GNU Toolchain"
 
is_arch64=`uname -m | grep 64`
if [ -z $is_arch64 ]
then
164,112 → 102,172
KERNEL_ARCH="64"
fi
 
cd $DIR_TO_INSTALL/tools;
 
#Creating directory structure
cecho "\nCreating directory structure"
cd ${DIR_TO_INSTALL}
execcmd "Creating directory ./download for downloaded packages" "mkdir -p download"
execcmd "Creating directory ./tools for package binaries" "mkdir -p tools"
 
 
#Downloading everything we need
cecho "\nDownloading packages"
cd ${DIR_TO_INSTALL}
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
execcmd "cd ${DIR_TO_INSTALL}/download"
if [ "$ENV" == "Cygwin" ]
then
execcmd "Download toolchain (it may take a while)" "wget ftp://ocuser:ocuser@openrisc.opencores.org/toolchain/or32-elf-cygwin-1.7.tar.bz2";
execcmd "Un-tar" "tar xf 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
if [ $KERNEL_ARCH == "32" ];
then
execcmd "Download toolchain (it may take a while)" "wget ftp://ocuser:ocuser@openrisc.opencores.org/toolchain/or32-elf-linux-x86.tar.bz2";
execcmd "Un-tar" "tar xf or32-elf-linux-x86.tar.bz2";
execcmd "Downloading GNU Toolchain" "wget ftp://ocuser:ocuser@openrisc.opencores.org/toolchain/or32-elf-linux-x86.tar.bz2";
elif [ $KERNEL_ARCH == "64" ];
then
execcmd "Download toolchain (it may take a while)" "wget ftp://ocuser:ocuser@openrisc.opencores.org/toolchain/or32-elf-linux-x86_64.tar.bz2";
execcmd "Un-tar" "tar xf or32-elf-linux-x86_64.tar.bz2";
else
errormsg "Not a correct architecture, $KERNEL_ARCH. Check Configurations";
execcmd "Downloading GNU Toolchain" "wget ftp://ocuser:ocuser@openrisc.opencores.org/toolchain/or32-elf-linux-x86_64.tar.bz2";
fi
fi
execcmd "Downloading GDB" "wget ftp://anonymous:anonymous@ftp.gnu.org/gnu/gdb/gdb-6.8.tar.bz2"
execcmd "wget ftp://ocuser:ocuser@openrisc.opencores.org/toolchain/or32-gdb-6.8-patch-2.4.bz2"
execcmd "svn export -q http://opencores.org/ocsvn/adv_debug_sys/adv_debug_sys/trunk/Patches/GDB6.8/gdb-6.8-bz436037-reg-no-longer-active.patch"
if [ "$ENV" != "Cygwin" ]
then
execcmd "Downloading libusb-0.1 for Advanced Debug System" "wget http://sourceforge.net/projects/libusb/files/libusb-0.1%20%28LEGACY%29/0.1.12/libusb-0.1.12.tar.gz"
fi
execcmd "Downloading libftdi for Advanced Debug System" "wget http://www.intra2net.com/en/developer/libftdi/download/libftdi-0.19.tar.gz"
execcmd "Downloading Icarus Verilog" "wget ftp://icarus.com/pub/eda/verilog/v0.9/verilog-0.9.4.tar.gz"
 
PATH=$PATH:$DIR_TO_INSTALL/tools/or32-elf/bin
 
#Uncompressing everything
cecho "\nUncompressing packages"
if [ "$ENV" == "Cygwin" ]
then
execcmd "tar xf or32-elf-cygwin-1.7.tar.bz2";
else
if [ $KERNEL_ARCH == "32" ];
then
execcmd "tar xf or32-elf-linux-x86.tar.bz2";
elif [ $KERNEL_ARCH == "64" ];
then
execcmd "tar xf or32-elf-linux-x86_64.tar.bz2";
fi
fi
execcmd "tar -jxf gdb-6.8.tar.bz2"
execcmd "bzip2 -d or32-gdb-6.8-patch-2.4.bz2"
if [ "$ENV" != "Cygwin" ]
then
execcmd "tar zxf libusb-0.1.12.tar.gz"
fi
execcmd "tar zxf libftdi-0.19.tar.gz"
execcmd "tar zxf verilog-0.9.4.tar.gz"
 
# Preparing MinSoC Specifics
cecho "I will now start to compile everything that's needed";
 
execcmd "cd ${DIR_TO_INSTALL}/minsoc/sw/utils"
execcmd "Make utils" "make"
#Compiling and Installing all packages
cecho "\nCompiling and installing packages"
# Installing the GNU Toolchain
execcmd "Installing GNU Toolchain" "cp -Rp or32-elf $DIR_TO_INSTALL/tools"
PATH=$PATH:$DIR_TO_INSTALL/tools/or32-elf/bin
 
execcmd "cd ../support"
execcmd "Make support tools" "make"
 
execcmd "cd ../drivers"
execcmd "Make drivers" "make"
#Installing GDB
execcmd "cd gdb-6.8"
execcmd "patch -p1 < ../or32-gdb-6.8-patch-2.4"
execcmd "patch -p1 < ../gdb-6.8-bz436037-reg-no-longer-active.patch"
 
execcmd "cd ../uart"
execcmd "Make UART" "make"
execcmd "mkdir -p build"
execcmd "cd build"
execcmd "../configure --target=or32-elf --disable-werror --prefix=$DIR_TO_INSTALL/tools"
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
PATH=$PATH:${DIR_TO_INSTALL}/tools/bin
 
 
# adv_jtag_bridge install
#Installing Advanced JTAG Bridge support libraries
if [ "$ENV" != "Cygwin" ]
then
execcmd "cd ${DIR_TO_INSTALL}/tools"
execcmd "Acquiring libusb-0.1 for Advanced Debug System" "wget http://sourceforge.net/projects/libusb/files/libusb-0.1%20%28LEGACY%29/0.1.12/libusb-0.1.12.tar.gz"
execcmd "tar zxf libusb-0.1.12.tar.gz"
execcmd "cd libusb-0.1.12"
execcmd "cd ${DIR_TO_INSTALL}/download/libusb-0.1.12"
execcmd "./configure --prefix=${DIR_TO_INSTALL}/tools"
execcmd "make"
execcmd "Installing libusb-0.1" "make"
execcmd "make install"
fi
 
execcmd "cd ${DIR_TO_INSTALL}/tools"
execcmd "Acquiring libftdi for Advanced Debug System" "wget http://www.intra2net.com/en/developer/libftdi/download/libftdi-0.19.tar.gz"
execcmd "tar zxf libftdi-0.19.tar.gz"
execcmd "cd libftdi-0.19"
execcmd "cd ${DIR_TO_INSTALL}/download/libftdi-0.19"
execcmd "./configure --prefix=${DIR_TO_INSTALL}/tools"
execcmd "make"
execcmd "Compiling libftdi" "make"
execcmd "make install"
 
execcmd "Compiling Advanced JTAG Bridge" "cd ${DIR_TO_INSTALL}/minsoc/rtl/verilog/adv_debug_sys/Software/adv_jtag_bridge"
 
#Installing Advanced JTAG Bridge
execcmd "cd ${DIR_TO_INSTALL}/minsoc/rtl/verilog/adv_debug_sys/Software/adv_jtag_bridge"
if [ `grep "INCLUDE_JSP_SERVER=true" Makefile` != "" ]
then
cecho "Switching off the adv_jtag_bridge JSP_SERVER option";
#Switching off the adv_jtag_bridge JSP_SERVER option
sed 's/INCLUDE_JSP_SERVER=true/INCLUDE_JSP_SERVER=false/' Makefile > TMPFILE && mv TMPFILE Makefile
fi
 
if [ "${ENV}" == "GNU/Linux" ]
then
cecho "Setting the right build environment";
#Setting the right build environment
sed 's/BUILD_ENVIRONMENT=cygwin/BUILD_ENVIRONMENT=linux/' Makefile > TMPFILE && mv TMPFILE Makefile
fi
 
#preparing the Makefile to find and link libraries
sed "s%prefix = /usr/local%prefix = ${DIR_TO_INSTALL}/tools%" Makefile > TMPFILE && mv TMPFILE Makefile
sed "s%\$(CC) \$(CFLAGS)%\$(CC) \$(CFLAGS) \$(INCLUDEDIRS)%" Makefile > TMPFILE && mv TMPFILE Makefile
sed "s%INCLUDEDIRS =%INCLUDEDIRS = -I${DIR_TO_INSTALL}/tools/include%" Makefile > TMPFILE && mv TMPFILE Makefile
sed "s%LIBS =%LIBS = -L${DIR_TO_INSTALL}/tools/lib -Wl,-R${DIR_TO_INSTALL}/tools/lib%" Makefile > TMPFILE && mv TMPFILE Makefile
 
execcmd "Make adv_jtag_bridge" "make"
execcmd "Installing adv_jtag_bridge" "make install"
#properly installing Advanced JTAG Bridge
execcmd "Compiling Advanced JTAG Bridge" "make"
execcmd "make install"
 
 
#install extra tools
execcmd "cd ${DIR_TO_INSTALL}/tools"
 
execcmd "Acquiring Icarus Verilog Tool" "wget ftp://icarus.com/pub/eda/verilog/v0.9/verilog-0.9.4.tar.gz"
execcmd "tar zxf verilog-0.9.4.tar.gz"
execcmd "cd verilog-0.9.4"
#Installing Icarus Verilog
execcmd "cd ${DIR_TO_INSTALL}/download/verilog-0.9.4"
execcmd "./configure --prefix=${DIR_TO_INSTALL}/tools"
execcmd "make"
execcmd "Compiling Icarus Verilog" "make"
execcmd "make install"
 
 
#Configuring MinSoC
cecho "\nConfiguring MinSoC"
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 "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
 
cecho "Compiling and moving adv_jtag_bridge debug modules for simulation"
#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"
 
 
#trying to set-up new variables
#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
cecho "\nSystem configurations"
execcmd "Adding MinSoC tools to PATH" "echo \"PATH=\\\$PATH:$DIR_TO_INSTALL/tools/bin\" >> /home/$(whoami)/.bashrc;";
execcmd "Adding OpenRISC toolchain to PATH" "echo \"PATH=\\\$PATH:$DIR_TO_INSTALL/tools/or32-elf/bin/\" >> /home/$(whoami)/.bashrc;";
cecho "Installation Finished"
 
cecho "\nInstallation Complete!"
cecho "Before using the system, load the new environment variables doing this: source /home/$(whoami)/.bashrc"
cecho "You may remove the ${DIR_TO_INSTALL}/download directory if you wish."
/setup/required-cygwin-tools.txt
1,6 → 1,8
packages:
util-linux (for whereis)
wget
subversion
patch
gcc
make
libncurses-devel

powered by: WebSVN 2.1.0

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