1 |
69 |
rfajardo |
#!/bin/bash
|
2 |
|
|
|
3 |
|
|
#NON STANDARD SCRIPT, USE ANOTHER AS TEMPLATE, NON STANDARD PART IS MARKED AS COMMENT
|
4 |
|
|
|
5 |
|
|
#new boards have to udpate this
|
6 |
|
|
BOARD=spartan3e_starter_kit_eth #this has to have the name of the directory this file is in
|
7 |
|
|
DEVICE_PART='xc3s500e-4-fg320'
|
8 |
|
|
CONSTRAINT_FILE='spartan3e_starter_kit_eth.ucf'
|
9 |
|
|
#~new boards update
|
10 |
|
|
|
11 |
|
|
#system workings
|
12 |
|
|
MINSOC_DIR=`pwd`/../..
|
13 |
|
|
BACKEND_DIR=$MINSOC_DIR/backend
|
14 |
|
|
SYN_DIR=$MINSOC_DIR/syn
|
15 |
|
|
SYNSRC_DIR=$SYN_DIR/src
|
16 |
|
|
SYNSUPPORT_DIR=$SYN_DIR/buildSupport
|
17 |
|
|
|
18 |
|
|
SYN_FILES=(eth_top.xst uart_top.xst adbg_top.xst or1200_top.xst minsoc_top.xst Makefile)
|
19 |
|
|
|
20 |
|
|
FIND_PART='DEVICE_PART'
|
21 |
|
|
FIND_CONSTRAINT='CONSTRAINT_FILE'
|
22 |
|
|
|
23 |
|
|
BOARD_DIR=$BACKEND_DIR/$BOARD
|
24 |
|
|
BOARD_FILES=(board.h orp.ld minsoc_defines.v minsoc_bench_defines.v gcc-opt.mk $CONSTRAINT_FILE)
|
25 |
|
|
|
26 |
|
|
in_minsoc=`pwd | grep minsoc/backend/${BOARD}$`
|
27 |
|
|
if [ -z $in_minsoc ]
|
28 |
|
|
then
|
29 |
|
|
echo ""
|
30 |
|
|
echo " !!!WARNING!!!"
|
31 |
|
|
echo "This script cannot be run out of a board directory inside minsoc/backend,"
|
32 |
|
|
echo "because it relies on the directory structure of the minsoc system."
|
33 |
|
|
echo ""
|
34 |
|
|
exit 1
|
35 |
|
|
fi
|
36 |
|
|
|
37 |
|
|
#NON STANDARD SCRIPT PART
|
38 |
|
|
echo "THIS SCRIPT HAS A NON-STANDARD BEGINNING."
|
39 |
|
|
echo "__________________________________________________________________________"
|
40 |
|
|
echo "Ethernet on Spartan3E Starter Kit requires another configuration for or1200."
|
41 |
|
|
echo "For minsoc release-1.0 or1200_r1 will be used."
|
42 |
|
|
echo "This will need or1200_defines.v of or1200_r1 with same configuration."
|
43 |
|
|
|
44 |
|
|
echo ""
|
45 |
|
|
echo "Copying or1200_defines.v, to or1200 implementation directory..."
|
46 |
|
|
echo "(minsoc/rtl/verilog/or1200/rtl/verilog)"
|
47 |
|
|
echo "__________________________________________________________________________"
|
48 |
|
|
cp $BOARD_DIR/or1200_defines.v $MINSOC_DIR/rtl/verilog/or1200/rtl/verilog
|
49 |
|
|
echo ""
|
50 |
|
|
echo "REGULAR SCRIPT STARTS NOW"
|
51 |
|
|
echo "__________________________________________________________________________"
|
52 |
|
|
#~NON STANDARD SCRIPT PART
|
53 |
|
|
|
54 |
|
|
echo ""
|
55 |
|
|
echo "Configuring SoC board's specific files for firmware compilation, "
|
56 |
|
|
echo "testbench generation and synthesis."
|
57 |
|
|
echo "Firmware and testbench looks for board specific files under minsoc/backend."
|
58 |
|
|
echo "Synthesis work under minsoc/syn."
|
59 |
|
|
echo ""
|
60 |
|
|
echo ""
|
61 |
|
|
|
62 |
|
|
if [ $CONSTRAINT_FILE == 'NONE' ]
|
63 |
|
|
then
|
64 |
|
|
echo "Skipping synthesis preparation. Standard implementation can only be simulated."
|
65 |
|
|
else
|
66 |
|
|
echo "Device part for files under minsoc/syn/src will be patched and stored "
|
67 |
|
|
echo "temporarily."
|
68 |
|
|
echo "Afterwards, they are copied to minsoc/syn/buildSupport."
|
69 |
|
|
echo "__________________________________________________________________________"
|
70 |
|
|
echo ""
|
71 |
|
|
for file in "${SYN_FILES[@]}"
|
72 |
|
|
do
|
73 |
|
|
echo "Updating synthesis file, $file..."
|
74 |
|
|
echo "Copying $file to synthesis directory..."
|
75 |
|
|
echo ""
|
76 |
|
|
sed "s/$FIND_PART/$DEVICE_PART/g" $SYNSRC_DIR/$file > TMPFILE
|
77 |
|
|
sed "s/$FIND_CONSTRAINT/$CONSTRAINT_FILE/g" TMPFILE > TMPFILE2 && mv TMPFILE2 $SYNSUPPORT_DIR/$file
|
78 |
|
|
rm TMPFILE
|
79 |
|
|
done
|
80 |
|
|
|
81 |
|
|
echo "Moving Makefile back from minsoc/syn/buildSupport to minsoc/syn..."
|
82 |
|
|
mv $SYNSUPPORT_DIR/Makefile $SYN_DIR
|
83 |
|
|
fi
|
84 |
|
|
echo ""
|
85 |
|
|
echo ""
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
echo "Copying board specific SoC files to backend directory."
|
89 |
|
|
echo "__________________________________________________________________________"
|
90 |
|
|
echo ""
|
91 |
|
|
for file in "${BOARD_FILES[@]}"
|
92 |
|
|
do
|
93 |
|
|
if [ $file != NONE ]
|
94 |
|
|
then
|
95 |
|
|
echo "Copying $file, to backend directory..."
|
96 |
|
|
cp $BOARD_DIR/$file $BACKEND_DIR
|
97 |
|
|
fi
|
98 |
|
|
done
|
99 |
|
|
echo ""
|
100 |
|
|
echo ""
|