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

Subversion Repositories minsoc

[/] [minsoc/] [trunk/] [backend/] [spartan3e_starter_kit_eth/] [configure] - Rev 169

Go to most recent revision | Compare with Previous | Blame | View Log

#!/bin/bash

#NON STANDARD SCRIPT, USE ANOTHER AS TEMPLATE, NON STANDARD PART IS MARKED AS COMMENT

#new boards have to udpate this
BOARD=spartan3e_starter_kit_eth                                         #this has to have the name of the directory this file is in
DEVICE_PART='xc3s500e-4-fg320'
CONSTRAINT_FILE='spartan3e_starter_kit_eth.ucf'
#~new boards update

#system workings
MINSOC_DIR=`pwd`/../..
BACKEND_DIR=$MINSOC_DIR/backend
SYN_DIR=$MINSOC_DIR/syn
SYNSRC_DIR=$MINSOC_DIR/prj/xilinx
SYNSUPPORT_DIR=$SYN_DIR/buildSupport
MAKEFILE_DIR=$SYN_DIR/xilinx

SYN_FILES=(ethmac.xst uart_top.xst adbg_top.xst or1200_top.xst minsoc_top.xst)
MAKEFILE=Makefile

FIND_PART='DEVICE_PART'
FIND_CONSTRAINT='CONSTRAINT_FILE'

BOARD_DIR=$BACKEND_DIR/$BOARD
BOARD_FILES=(board.h orp.ld minsoc_defines.v minsoc_bench_defines.v gcc-opt.mk $CONSTRAINT_FILE)

in_minsoc=`pwd | grep minsoc/backend/${BOARD}$`
if [ -z $in_minsoc ]
then
        echo ""
        echo "                  !!!WARNING!!!"
        echo "This script cannot be run if not in a board directory inside minsoc/backend,"
        echo "because it relies on the directory structure of the minsoc system."
        echo ""
        echo "Possibly your minsoc directory is named differently, minsoc_trunk for example."
        echo "Its name must be minsoc only."
        echo ""
    exit 1
fi

#NON STANDARD SCRIPT PART
echo "THIS SCRIPT HAS A NON-STANDARD BEGINNING."
echo "__________________________________________________________________________"
echo "${BOARD} requires another configuration for or1200."
echo ""

echo "Otherwise, the design won't fit on your FPGA because of area restrictions. If you select no, you can manually copy the or1200_defines.v from this directory to minsoc/rtl/verilog/or1200/rtl/verilog later to overcome this safely."
echo ""

echo -n "This will modify the standard or1200_defines.v file. Proceed? [Y/n]: "
read REPLY;
if [ "$REPLY" = "y" ] || [ -z "$REPLY" ]
then
        echo ""
        echo "Backing up original or1200_defines.v as or1200_defines.bak..."   
        echo "Copying or1200_defines.v, to or1200 implementation directory..."   
        echo "(minsoc/rtl/verilog/or1200/rtl/verilog)"
        echo "__________________________________________________________________________"
        mv $MINSOC_DIR/rtl/verilog/or1200/rtl/verilog/or1200_defines.v $MINSOC_DIR/rtl/verilog/or1200/rtl/verilog/or1200_defines.bak 
        cp $BOARD_DIR/or1200_defines.v $MINSOC_DIR/rtl/verilog/or1200/rtl/verilog
fi
echo ""
echo "REGULAR SCRIPT STARTS NOW"
echo "__________________________________________________________________________"
#~NON STANDARD SCRIPT PART

echo ""
echo "This script sets up the SoC for simulations and synthesis."
echo ""
echo "In order to do so, SoC board's specific files for firmware compilation, "
echo "testbench generation and synthesis are configured."
echo "Firmware and testbench looks for board specific files under $BACKEND_DIR."
echo "Synthesis work under $SYN_DIR."
echo ""
echo ""

echo "Copying board specific SoC files from $BOARD_DIR to $BACKEND_DIR directory."
echo "__________________________________________________________________________"
echo ""
for file in "${BOARD_FILES[@]}"
do
    if [ $file != NONE ]
    then
        echo "Copying $file, to backend directory..."
        cp $BOARD_DIR/$file $BACKEND_DIR
    fi
done
echo ""
echo ""

echo "Generating project files for simulation and synthesis..."
echo "__________________________________________________________________________"
echo ""
make -C $MINSOC_DIR/prj
echo "Generation complete."
echo ""
echo ""

if [ $CONSTRAINT_FILE == 'NONE' ]
then
    echo "Skipping synthesis preparation. Standard implementation can only be simulated."
    echo ""
    echo ""
else
    echo "Device part for files under $SYNSRC_DIR will be patched and stored "
    echo "temporarily." 
    echo "Afterwards, they are copied to $SYNSUPPORT_DIR."
    echo "__________________________________________________________________________"
    echo ""
    for file in "${SYN_FILES[@]}"
    do
        echo "Updating synthesis file, $file..."
        echo "Copying $file to synthesis directory..."
        echo ""
        sed "s/$FIND_PART/$DEVICE_PART/g" $SYNSRC_DIR/$file > TMPFILE
        sed "s/$FIND_CONSTRAINT/$CONSTRAINT_FILE/g" TMPFILE > TMPFILE2 && mv TMPFILE2 $SYNSUPPORT_DIR/$file
        rm TMPFILE
    done

    echo "Updating Makefile file under $MAKEFILE_DIR..."
    echo "Copying Makefile to synthesis directory, $SYN_DIR..."
    echo ""
    sed "s/$FIND_PART/$DEVICE_PART/g" $MAKEFILE_DIR/$MAKEFILE > TMPFILE
    sed "s/$FIND_CONSTRAINT/$CONSTRAINT_FILE/g" TMPFILE > TMPFILE2 && mv TMPFILE2 $SYN_DIR/$MAKEFILE
    rm TMPFILE
    cp $MAKEFILE_DIR/setup.bat $SYN_DIR/setup.bat
    echo ""
    echo ""
fi

#Precompiling firmwares
echo "Precompiling delivered libraries and firmwares..."
make -C ../../sw/utils
make -C ../../sw/support
make -C ../../sw/drivers
make -C ../../sw/uart
make -C ../../sw/jsp
make -C ../../sw/eth
echo "done."
echo ""
echo ""

echo "Configuration done."

Go to most recent revision | 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.