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 |
85 |
rfajardo |
SYNSRC_DIR=$MINSOC_DIR/prj/xilinx
|
16 |
69 |
rfajardo |
SYNSUPPORT_DIR=$SYN_DIR/buildSupport
|
17 |
85 |
rfajardo |
MAKEFILE_DIR=$SYN_DIR/xilinx
|
18 |
69 |
rfajardo |
|
19 |
85 |
rfajardo |
SYN_FILES=(ethmac.xst uart_top.xst adbg_top.xst or1200_top.xst minsoc_top.xst)
|
20 |
|
|
MAKEFILE=Makefile
|
21 |
69 |
rfajardo |
|
22 |
|
|
FIND_PART='DEVICE_PART'
|
23 |
|
|
FIND_CONSTRAINT='CONSTRAINT_FILE'
|
24 |
|
|
|
25 |
|
|
BOARD_DIR=$BACKEND_DIR/$BOARD
|
26 |
|
|
BOARD_FILES=(board.h orp.ld minsoc_defines.v minsoc_bench_defines.v gcc-opt.mk $CONSTRAINT_FILE)
|
27 |
|
|
|
28 |
|
|
in_minsoc=`pwd | grep minsoc/backend/${BOARD}$`
|
29 |
|
|
if [ -z $in_minsoc ]
|
30 |
|
|
then
|
31 |
|
|
echo ""
|
32 |
|
|
echo " !!!WARNING!!!"
|
33 |
85 |
rfajardo |
echo "This script cannot be run if not in a board directory inside minsoc/backend,"
|
34 |
69 |
rfajardo |
echo "because it relies on the directory structure of the minsoc system."
|
35 |
|
|
echo ""
|
36 |
85 |
rfajardo |
echo "Possibly your minsoc directory is named differently, minsoc_trunk for example."
|
37 |
|
|
echo "Its name must be minsoc only."
|
38 |
|
|
echo ""
|
39 |
87 |
rfajardo |
exit 1
|
40 |
69 |
rfajardo |
fi
|
41 |
|
|
|
42 |
|
|
#NON STANDARD SCRIPT PART
|
43 |
|
|
echo "THIS SCRIPT HAS A NON-STANDARD BEGINNING."
|
44 |
|
|
echo "__________________________________________________________________________"
|
45 |
|
|
echo "Ethernet on Spartan3E Starter Kit requires another configuration for or1200."
|
46 |
|
|
echo "For minsoc release-1.0 or1200_r1 will be used."
|
47 |
|
|
echo "This will need or1200_defines.v of or1200_r1 with same configuration."
|
48 |
|
|
|
49 |
|
|
echo ""
|
50 |
|
|
echo "Copying or1200_defines.v, to or1200 implementation directory..."
|
51 |
|
|
echo "(minsoc/rtl/verilog/or1200/rtl/verilog)"
|
52 |
|
|
echo "__________________________________________________________________________"
|
53 |
|
|
cp $BOARD_DIR/or1200_defines.v $MINSOC_DIR/rtl/verilog/or1200/rtl/verilog
|
54 |
|
|
echo ""
|
55 |
|
|
echo "REGULAR SCRIPT STARTS NOW"
|
56 |
|
|
echo "__________________________________________________________________________"
|
57 |
|
|
#~NON STANDARD SCRIPT PART
|
58 |
|
|
|
59 |
|
|
echo ""
|
60 |
|
|
echo "Configuring SoC board's specific files for firmware compilation, "
|
61 |
|
|
echo "testbench generation and synthesis."
|
62 |
|
|
echo "Firmware and testbench looks for board specific files under minsoc/backend."
|
63 |
|
|
echo "Synthesis work under minsoc/syn."
|
64 |
|
|
echo ""
|
65 |
|
|
echo ""
|
66 |
|
|
|
67 |
|
|
if [ $CONSTRAINT_FILE == 'NONE' ]
|
68 |
|
|
then
|
69 |
|
|
echo "Skipping synthesis preparation. Standard implementation can only be simulated."
|
70 |
|
|
else
|
71 |
86 |
rfajardo |
echo "Device part for files under minsoc/prj/xilinx will be patched and stored "
|
72 |
69 |
rfajardo |
echo "temporarily."
|
73 |
|
|
echo "Afterwards, they are copied to minsoc/syn/buildSupport."
|
74 |
|
|
echo "__________________________________________________________________________"
|
75 |
|
|
echo ""
|
76 |
|
|
for file in "${SYN_FILES[@]}"
|
77 |
|
|
do
|
78 |
|
|
echo "Updating synthesis file, $file..."
|
79 |
|
|
echo "Copying $file to synthesis directory..."
|
80 |
|
|
echo ""
|
81 |
|
|
sed "s/$FIND_PART/$DEVICE_PART/g" $SYNSRC_DIR/$file > TMPFILE
|
82 |
|
|
sed "s/$FIND_CONSTRAINT/$CONSTRAINT_FILE/g" TMPFILE > TMPFILE2 && mv TMPFILE2 $SYNSUPPORT_DIR/$file
|
83 |
|
|
rm TMPFILE
|
84 |
|
|
done
|
85 |
|
|
|
86 |
85 |
rfajardo |
echo "Updating Makefile file..."
|
87 |
|
|
echo "Copying Makefile to synthesis directory..."
|
88 |
|
|
echo ""
|
89 |
|
|
sed "s/$FIND_PART/$DEVICE_PART/g" $MAKEFILE_DIR/$MAKEFILE > TMPFILE
|
90 |
|
|
sed "s/$FIND_CONSTRAINT/$CONSTRAINT_FILE/g" TMPFILE > TMPFILE2 && mv TMPFILE2 $SYN_DIR/$MAKEFILE
|
91 |
|
|
rm TMPFILE
|
92 |
69 |
rfajardo |
fi
|
93 |
|
|
echo ""
|
94 |
|
|
echo ""
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
echo "Copying board specific SoC files to backend directory."
|
98 |
|
|
echo "__________________________________________________________________________"
|
99 |
|
|
echo ""
|
100 |
|
|
for file in "${BOARD_FILES[@]}"
|
101 |
|
|
do
|
102 |
|
|
if [ $file != NONE ]
|
103 |
|
|
then
|
104 |
|
|
echo "Copying $file, to backend directory..."
|
105 |
|
|
cp $BOARD_DIR/$file $BACKEND_DIR
|
106 |
|
|
fi
|
107 |
|
|
done
|
108 |
|
|
echo ""
|
109 |
|
|
echo ""
|