1 |
146 |
ConX. |
#!/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=ug257 #this has to have the name of the directory this file is in
|
7 |
|
|
DEVICE_PART='xc3s1600e-4-fg320'
|
8 |
|
|
CONSTRAINT_FILE='ug257.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=$MINSOC_DIR/prj/xilinx
|
16 |
|
|
SYNSUPPORT_DIR=$SYN_DIR/buildSupport
|
17 |
|
|
MAKEFILE_DIR=$SYN_DIR/xilinx
|
18 |
|
|
|
19 |
|
|
SYN_FILES=(ethmac.xst uart_top.xst adbg_top.xst or1200_top.xst minsoc_top.xst)
|
20 |
|
|
MAKEFILE=Makefile
|
21 |
|
|
|
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 |
|
|
echo "This script cannot be run if not in a board directory inside minsoc/backend,"
|
34 |
|
|
echo "because it relies on the directory structure of the minsoc system."
|
35 |
|
|
echo ""
|
36 |
|
|
echo "Possibly your minsoc directory is named differently, minsoc_trunk for example."
|
37 |
|
|
echo "Its name must be minsoc only."
|
38 |
|
|
echo ""
|
39 |
|
|
exit 1
|
40 |
|
|
fi
|
41 |
|
|
|
42 |
|
|
#NON STANDARD SCRIPT PART
|
43 |
|
|
echo "THIS SCRIPT HAS A NON-STANDARD BEGINNING."
|
44 |
|
|
echo "__________________________________________________________________________"
|
45 |
|
|
echo "${BOARD} requires another configuration for or1200_rel1."
|
46 |
|
|
|
47 |
|
|
echo ""
|
48 |
|
|
echo "Copying or1200_defines.v, to or1200 implementation directory..."
|
49 |
|
|
echo "(minsoc/rtl/verilog/or1200/rtl/verilog)"
|
50 |
|
|
echo "__________________________________________________________________________"
|
51 |
|
|
cp $BOARD_DIR/or1200_defines.v $MINSOC_DIR/rtl/verilog/or1200/rtl/verilog
|
52 |
|
|
echo ""
|
53 |
|
|
echo "REGULAR SCRIPT STARTS NOW"
|
54 |
|
|
echo "__________________________________________________________________________"
|
55 |
|
|
#~NON STANDARD SCRIPT PART
|
56 |
|
|
|
57 |
|
|
echo ""
|
58 |
|
|
echo "This script sets up the SoC for simulations and synthesis."
|
59 |
|
|
echo ""
|
60 |
|
|
echo "In order to do so, SoC board's specific files for firmware compilation, "
|
61 |
|
|
echo "testbench generation and synthesis are configured."
|
62 |
|
|
echo "Firmware and testbench looks for board specific files under $BACKEND_DIR."
|
63 |
|
|
echo "Synthesis work under $SYN_DIR."
|
64 |
|
|
echo ""
|
65 |
|
|
echo ""
|
66 |
|
|
|
67 |
|
|
echo "Copying board specific SoC files from $BOARD_DIR to $BACKEND_DIR directory."
|
68 |
|
|
echo "__________________________________________________________________________"
|
69 |
|
|
echo ""
|
70 |
|
|
for file in "${BOARD_FILES[@]}"
|
71 |
|
|
do
|
72 |
|
|
if [ $file != NONE ]
|
73 |
|
|
then
|
74 |
|
|
echo "Copying $file, to backend directory..."
|
75 |
|
|
cp $BOARD_DIR/$file $BACKEND_DIR
|
76 |
|
|
fi
|
77 |
|
|
done
|
78 |
|
|
echo ""
|
79 |
|
|
echo ""
|
80 |
|
|
|
81 |
|
|
echo "Generating project files for simulation and synthesis..."
|
82 |
|
|
echo "__________________________________________________________________________"
|
83 |
|
|
echo ""
|
84 |
|
|
make -C $MINSOC_DIR/prj
|
85 |
|
|
echo "Generation complete."
|
86 |
|
|
echo ""
|
87 |
|
|
echo ""
|
88 |
|
|
|
89 |
|
|
if [ $CONSTRAINT_FILE == 'NONE' ]
|
90 |
|
|
then
|
91 |
|
|
echo "Skipping synthesis preparation. Standard implementation can only be simulated."
|
92 |
|
|
echo ""
|
93 |
|
|
echo ""
|
94 |
|
|
else
|
95 |
|
|
echo "Device part for files under $SYNSRC_DIR will be patched and stored "
|
96 |
|
|
echo "temporarily."
|
97 |
|
|
echo "Afterwards, they are copied to $SYNSUPPORT_DIR."
|
98 |
|
|
echo "__________________________________________________________________________"
|
99 |
|
|
echo ""
|
100 |
|
|
for file in "${SYN_FILES[@]}"
|
101 |
|
|
do
|
102 |
|
|
echo "Updating synthesis file, $file..."
|
103 |
|
|
echo "Copying $file to synthesis directory..."
|
104 |
|
|
echo ""
|
105 |
|
|
sed "s/$FIND_PART/$DEVICE_PART/g" $SYNSRC_DIR/$file > TMPFILE
|
106 |
|
|
sed "s/$FIND_CONSTRAINT/$CONSTRAINT_FILE/g" TMPFILE > TMPFILE2 && mv TMPFILE2 $SYNSUPPORT_DIR/$file
|
107 |
|
|
rm TMPFILE
|
108 |
|
|
done
|
109 |
|
|
|
110 |
|
|
echo "Updating Makefile file under $MAKEFILE_DIR..."
|
111 |
|
|
echo "Copying Makefile to synthesis directory, $SYN_DIR..."
|
112 |
|
|
echo ""
|
113 |
|
|
sed "s/$FIND_PART/$DEVICE_PART/g" $MAKEFILE_DIR/$MAKEFILE > TMPFILE
|
114 |
|
|
sed "s/$FIND_CONSTRAINT/$CONSTRAINT_FILE/g" TMPFILE > TMPFILE2 && mv TMPFILE2 $SYN_DIR/$MAKEFILE
|
115 |
|
|
rm TMPFILE
|
116 |
|
|
cp $MAKEFILE_DIR/setup.bat $SYN_DIR/setup.bat
|
117 |
|
|
echo ""
|
118 |
|
|
echo ""
|
119 |
|
|
fi
|
120 |
|
|
|
121 |
|
|
#Precompiling firmwares
|
122 |
|
|
echo "Precompiling delivered libraries and firmwares..."
|
123 |
|
|
make -C ../../sw/utils
|
124 |
|
|
make -C ../../sw/support
|
125 |
|
|
make -C ../../sw/drivers
|
126 |
|
|
make -C ../../sw/uart
|
127 |
|
|
make -C ../../sw/eth
|
128 |
|
|
echo "done."
|
129 |
|
|
echo ""
|
130 |
|
|
echo ""
|
131 |
|
|
|
132 |
|
|
echo "Configuration done."
|