#!/bin/bash
|
#!/bin/bash
|
|
|
#NON STANDARD SCRIPT, USE ANOTHER AS TEMPLATE, NON STANDARD PART IS MARKED AS COMMENT
|
#NON STANDARD SCRIPT, USE ANOTHER AS TEMPLATE, NON STANDARD PART IS MARKED AS COMMENT
|
|
|
#new boards have to udpate this
|
#new boards have to udpate this
|
BOARD=spartan3e_starter_kit #this has to have the name of the directory this file is in
|
BOARD=spartan3e_starter_kit #this has to have the name of the directory this file is in
|
DEVICE_PART='xc3s500e-4-fg320'
|
DEVICE_PART='xc3s500e-4-fg320'
|
CONSTRAINT_FILE='spartan3e_starter_kit.ucf'
|
CONSTRAINT_FILE='spartan3e_starter_kit.ucf'
|
#~new boards update
|
#~new boards update
|
|
|
#system workings
|
#system workings
|
MINSOC_DIR=`pwd`/../..
|
MINSOC_DIR=`pwd`/../..
|
BACKEND_DIR=$MINSOC_DIR/backend
|
BACKEND_DIR=$MINSOC_DIR/backend
|
SYN_DIR=$MINSOC_DIR/syn
|
SYN_DIR=$MINSOC_DIR/syn
|
SYNSRC_DIR=$MINSOC_DIR/prj/xilinx
|
SYNSRC_DIR=$MINSOC_DIR/prj/xilinx
|
SYNSUPPORT_DIR=$SYN_DIR/buildSupport
|
SYNSUPPORT_DIR=$SYN_DIR/buildSupport
|
MAKEFILE_DIR=$SYN_DIR/xilinx
|
MAKEFILE_DIR=$SYN_DIR/xilinx
|
|
|
SYN_FILES=(ethmac.xst uart_top.xst adbg_top.xst or1200_top.xst minsoc_top.xst)
|
SYN_FILES=(ethmac.xst uart_top.xst adbg_top.xst or1200_top.xst minsoc_top.xst)
|
MAKEFILE=Makefile
|
MAKEFILE=Makefile
|
|
|
FIND_PART='DEVICE_PART'
|
FIND_PART='DEVICE_PART'
|
FIND_CONSTRAINT='CONSTRAINT_FILE'
|
FIND_CONSTRAINT='CONSTRAINT_FILE'
|
|
|
BOARD_DIR=$BACKEND_DIR/$BOARD
|
BOARD_DIR=$BACKEND_DIR/$BOARD
|
BOARD_FILES=(board.h orp.ld minsoc_defines.v minsoc_bench_defines.v gcc-opt.mk $CONSTRAINT_FILE)
|
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}$`
|
in_minsoc=`pwd | grep minsoc/backend/${BOARD}$`
|
if [ -z $in_minsoc ]
|
if [ -z $in_minsoc ]
|
then
|
then
|
echo ""
|
echo ""
|
echo " !!!WARNING!!!"
|
echo " !!!WARNING!!!"
|
echo "This script cannot be run if not in a board directory inside minsoc/backend,"
|
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 "because it relies on the directory structure of the minsoc system."
|
echo ""
|
echo ""
|
echo "Possibly your minsoc directory is named differently, minsoc_trunk for example."
|
echo "Possibly your minsoc directory is named differently, minsoc_trunk for example."
|
echo "Its name must be minsoc only."
|
echo "Its name must be minsoc only."
|
echo ""
|
echo ""
|
|
exit 1
|
fi
|
fi
|
|
|
#NON STANDARD SCRIPT PART
|
#NON STANDARD SCRIPT PART
|
echo "THIS SCRIPT HAS A NON-STANDARD BEGINNING."
|
echo "THIS SCRIPT HAS A NON-STANDARD BEGINNING."
|
echo "__________________________________________________________________________"
|
echo "__________________________________________________________________________"
|
echo "Spartan3E Starter Kit requires another configuration for or1200_r3."
|
echo "Spartan3E Starter Kit requires another configuration for or1200_r3."
|
echo "or1200_r1 should work fine, roll back this for minsoc release-1.0."
|
echo "or1200_r1 should work fine, roll back this for minsoc release-1.0."
|
|
|
echo ""
|
echo ""
|
echo "Copying or1200_defines.v, to or1200 implementation directory..."
|
echo "Copying or1200_defines.v, to or1200 implementation directory..."
|
echo "(minsoc/rtl/verilog/or1200/rtl/verilog)"
|
echo "(minsoc/rtl/verilog/or1200/rtl/verilog)"
|
echo "__________________________________________________________________________"
|
echo "__________________________________________________________________________"
|
cp $BOARD_DIR/or1200_defines.v $MINSOC_DIR/rtl/verilog/or1200/rtl/verilog
|
cp $BOARD_DIR/or1200_defines.v $MINSOC_DIR/rtl/verilog/or1200/rtl/verilog
|
echo ""
|
echo ""
|
echo "REGULAR SCRIPT STARTS NOW"
|
echo "REGULAR SCRIPT STARTS NOW"
|
echo "__________________________________________________________________________"
|
echo "__________________________________________________________________________"
|
#~NON STANDARD SCRIPT PART
|
#~NON STANDARD SCRIPT PART
|
|
|
echo ""
|
echo ""
|
echo "Configuring SoC board's specific files for firmware compilation, "
|
echo "Configuring SoC board's specific files for firmware compilation, "
|
echo "testbench generation and synthesis."
|
echo "testbench generation and synthesis."
|
echo "Firmware and testbench looks for board specific files under minsoc/backend."
|
echo "Firmware and testbench looks for board specific files under minsoc/backend."
|
echo "Synthesis work under minsoc/syn."
|
echo "Synthesis work under minsoc/syn."
|
echo ""
|
echo ""
|
echo ""
|
echo ""
|
|
|
if [ $CONSTRAINT_FILE == 'NONE' ]
|
if [ $CONSTRAINT_FILE == 'NONE' ]
|
then
|
then
|
echo "Skipping synthesis preparation. Standard implementation can only be simulated."
|
echo "Skipping synthesis preparation. Standard implementation can only be simulated."
|
else
|
else
|
echo "Device part for files under minsoc/prj/xilinx will be patched and stored "
|
echo "Device part for files under minsoc/prj/xilinx will be patched and stored "
|
echo "temporarily."
|
echo "temporarily."
|
echo "Afterwards, they are copied to minsoc/syn/buildSupport."
|
echo "Afterwards, they are copied to minsoc/syn/buildSupport."
|
echo "__________________________________________________________________________"
|
echo "__________________________________________________________________________"
|
echo ""
|
echo ""
|
for file in "${SYN_FILES[@]}"
|
for file in "${SYN_FILES[@]}"
|
do
|
do
|
echo "Updating synthesis file, $file..."
|
echo "Updating synthesis file, $file..."
|
echo "Copying $file to synthesis directory..."
|
echo "Copying $file to synthesis directory..."
|
echo ""
|
echo ""
|
sed "s/$FIND_PART/$DEVICE_PART/g" $SYNSRC_DIR/$file > TMPFILE
|
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
|
sed "s/$FIND_CONSTRAINT/$CONSTRAINT_FILE/g" TMPFILE > TMPFILE2 && mv TMPFILE2 $SYNSUPPORT_DIR/$file
|
rm TMPFILE
|
rm TMPFILE
|
done
|
done
|
|
|
echo "Updating Makefile file..."
|
echo "Updating Makefile file..."
|
echo "Copying Makefile to synthesis directory..."
|
echo "Copying Makefile to synthesis directory..."
|
echo ""
|
echo ""
|
sed "s/$FIND_PART/$DEVICE_PART/g" $MAKEFILE_DIR/$MAKEFILE > TMPFILE
|
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
|
sed "s/$FIND_CONSTRAINT/$CONSTRAINT_FILE/g" TMPFILE > TMPFILE2 && mv TMPFILE2 $SYN_DIR/$MAKEFILE
|
rm TMPFILE
|
rm TMPFILE
|
fi
|
fi
|
echo ""
|
echo ""
|
echo ""
|
echo ""
|
|
|
|
|
echo "Copying board specific SoC files to backend directory."
|
echo "Copying board specific SoC files to backend directory."
|
echo "__________________________________________________________________________"
|
echo "__________________________________________________________________________"
|
echo ""
|
echo ""
|
for file in "${BOARD_FILES[@]}"
|
for file in "${BOARD_FILES[@]}"
|
do
|
do
|
if [ $file != NONE ]
|
if [ $file != NONE ]
|
then
|
then
|
echo "Copying $file, to backend directory..."
|
echo "Copying $file, to backend directory..."
|
cp $BOARD_DIR/$file $BACKEND_DIR
|
cp $BOARD_DIR/$file $BACKEND_DIR
|
fi
|
fi
|
done
|
done
|
echo ""
|
echo ""
|
echo ""
|
echo ""
|
|
|