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 |
|
|
echo ""
|
43 |
|
|
echo "This script sets up the SoC for simulations and synthesis."
|
44 |
|
|
echo ""
|
45 |
|
|
echo "In order to do so, SoC board's specific files for firmware compilation, "
|
46 |
|
|
echo "testbench generation and synthesis are configured."
|
47 |
|
|
echo "Firmware and testbench looks for board specific files under $BACKEND_DIR."
|
48 |
|
|
echo "Synthesis work under $SYN_DIR."
|
49 |
|
|
echo ""
|
50 |
|
|
echo ""
|
51 |
|
|
|
52 |
|
|
echo "Copying board specific SoC files from $BOARD_DIR to $BACKEND_DIR directory."
|
53 |
|
|
echo "__________________________________________________________________________"
|
54 |
|
|
echo ""
|
55 |
|
|
for file in "${BOARD_FILES[@]}"
|
56 |
|
|
do
|
57 |
|
|
if [ $file != NONE ]
|
58 |
|
|
then
|
59 |
|
|
echo "Copying $file, to backend directory..."
|
60 |
|
|
cp $BOARD_DIR/$file $BACKEND_DIR
|
61 |
|
|
fi
|
62 |
|
|
done
|
63 |
|
|
echo ""
|
64 |
|
|
echo ""
|
65 |
|
|
|
66 |
|
|
echo "Generating project files for simulation and synthesis..."
|
67 |
|
|
echo "__________________________________________________________________________"
|
68 |
|
|
echo ""
|
69 |
|
|
make -C $MINSOC_DIR/prj
|
70 |
|
|
echo "Generation complete."
|
71 |
|
|
echo ""
|
72 |
|
|
echo ""
|
73 |
|
|
|
74 |
|
|
if [ $CONSTRAINT_FILE == 'NONE' ]
|
75 |
|
|
then
|
76 |
|
|
echo "Skipping synthesis preparation. Standard implementation can only be simulated."
|
77 |
|
|
echo ""
|
78 |
|
|
echo ""
|
79 |
|
|
else
|
80 |
|
|
echo "Device part for files under $SYNSRC_DIR will be patched and stored "
|
81 |
|
|
echo "temporarily."
|
82 |
|
|
echo "Afterwards, they are copied to $SYNSUPPORT_DIR."
|
83 |
|
|
echo "__________________________________________________________________________"
|
84 |
|
|
echo ""
|
85 |
|
|
for file in "${SYN_FILES[@]}"
|
86 |
|
|
do
|
87 |
|
|
echo "Updating synthesis file, $file..."
|
88 |
|
|
echo "Copying $file to synthesis directory..."
|
89 |
|
|
echo ""
|
90 |
|
|
sed "s/$FIND_PART/$DEVICE_PART/g" $SYNSRC_DIR/$file > TMPFILE
|
91 |
|
|
sed "s/$FIND_CONSTRAINT/$CONSTRAINT_FILE/g" TMPFILE > TMPFILE2 && mv TMPFILE2 $SYNSUPPORT_DIR/$file
|
92 |
|
|
rm TMPFILE
|
93 |
|
|
done
|
94 |
|
|
|
95 |
|
|
echo "Updating Makefile file under $MAKEFILE_DIR..."
|
96 |
|
|
echo "Copying Makefile to synthesis directory, $SYN_DIR..."
|
97 |
|
|
echo ""
|
98 |
|
|
sed "s/$FIND_PART/$DEVICE_PART/g" $MAKEFILE_DIR/$MAKEFILE > TMPFILE
|
99 |
|
|
sed "s/$FIND_CONSTRAINT/$CONSTRAINT_FILE/g" TMPFILE > TMPFILE2 && mv TMPFILE2 $SYN_DIR/$MAKEFILE
|
100 |
|
|
rm TMPFILE
|
101 |
|
|
cp $MAKEFILE_DIR/setup.bat $SYN_DIR/setup.bat
|
102 |
|
|
echo ""
|
103 |
|
|
echo ""
|
104 |
|
|
fi
|
105 |
|
|
|
106 |
|
|
#Precompiling firmwares
|
107 |
|
|
echo "Precompiling delivered libraries and firmwares..."
|
108 |
|
|
make -C ../../sw/utils
|
109 |
|
|
make -C ../../sw/support
|
110 |
|
|
make -C ../../sw/drivers
|
111 |
|
|
make -C ../../sw/uart
|
112 |
158 |
rfajardo |
make -C ../../sw/jsp
|
113 |
146 |
ConX. |
make -C ../../sw/eth
|
114 |
|
|
echo "done."
|
115 |
|
|
echo ""
|
116 |
|
|
echo ""
|
117 |
|
|
|
118 |
|
|
echo "Configuration done."
|