1 |
158 |
rfajardo |
#!/bin/bash
|
2 |
|
|
|
3 |
|
|
#new boards have to udpate this
|
4 |
|
|
BOARD=de2_115_board #this has to have the name of the directory this file is in
|
5 |
|
|
DEVICE_PART=EP4CE115F29C7
|
6 |
|
|
CONSTRAINT_FILE='de2_115_board.ucf'
|
7 |
|
|
FAMILY_PART="Cyclone IV E"
|
8 |
|
|
#~new boards update
|
9 |
|
|
|
10 |
|
|
#system workings
|
11 |
|
|
MINSOC_DIR=`pwd`/../..
|
12 |
|
|
BACKEND_DIR=$MINSOC_DIR/backend
|
13 |
|
|
SYN_DIR=$MINSOC_DIR/syn
|
14 |
|
|
SYNSRC_DIR=$MINSOC_DIR/prj/altera
|
15 |
|
|
SYNSUPPORT_DIR=$SYN_DIR/buildSupport
|
16 |
|
|
MAKEFILE_DIR=$SYN_DIR/altera
|
17 |
|
|
|
18 |
|
|
PROJECT_FILE=minsoc_top.qsf
|
19 |
|
|
|
20 |
|
|
SYN_FILES=(adbg_top.vprj jtag_top.vprj or1200_top.vprj uart_top.vprj minsoc_top.vprj altera_virtual_jtag.vhdprj)
|
21 |
|
|
MAKEFILE=Makefile
|
22 |
|
|
|
23 |
|
|
FIND_PART='DEVICE_PART'
|
24 |
|
|
FIND_FAMILY='FAMILY_PART'
|
25 |
|
|
FIND_VERSION='SW_VERSION'
|
26 |
|
|
FIND_CONSTRAINT='CONSTRAINT_FILE'
|
27 |
|
|
|
28 |
|
|
BOARD_DIR=$BACKEND_DIR/$BOARD
|
29 |
|
|
BOARD_FILES=(board.h orp.ld minsoc_defines.v minsoc_bench_defines.v gcc-opt.mk $CONSTRAINT_FILE)
|
30 |
|
|
|
31 |
|
|
in_minsoc=`pwd | grep minsoc/backend/${BOARD}$`
|
32 |
|
|
if [ -z $in_minsoc ]
|
33 |
|
|
then
|
34 |
|
|
echo ""
|
35 |
|
|
echo " !!!WARNING!!!"
|
36 |
|
|
echo "This script cannot be run if not in a board directory inside minsoc/backend,"
|
37 |
|
|
echo "because it relies on the directory structure of the minsoc system."
|
38 |
|
|
echo ""
|
39 |
|
|
echo "Possibly your minsoc directory is named differently, minsoc_trunk for example."
|
40 |
|
|
echo "Its name must be minsoc only."
|
41 |
|
|
echo ""
|
42 |
|
|
exit 1
|
43 |
|
|
fi
|
44 |
|
|
|
45 |
|
|
echo ""
|
46 |
|
|
echo "This script sets up the SoC for simulations and synthesis."
|
47 |
|
|
echo ""
|
48 |
|
|
echo "In order to do so, SoC board's specific files for firmware compilation, "
|
49 |
|
|
echo "testbench generation and synthesis are configured."
|
50 |
|
|
echo "Firmware and testbench looks for board specific files under $BACKEND_DIR."
|
51 |
|
|
echo "Synthesis work under $SYN_DIR."
|
52 |
|
|
echo ""
|
53 |
|
|
echo ""
|
54 |
|
|
|
55 |
|
|
echo "Copying board specific SoC files from $BOARD_DIR to $BACKEND_DIR directory."
|
56 |
|
|
echo "__________________________________________________________________________"
|
57 |
|
|
echo ""
|
58 |
|
|
for file in "${BOARD_FILES[@]}"
|
59 |
|
|
do
|
60 |
|
|
if [ $file != NONE ]
|
61 |
|
|
then
|
62 |
|
|
echo "Copying $file, to backend directory..."
|
63 |
|
|
cp $BOARD_DIR/$file $BACKEND_DIR
|
64 |
|
|
fi
|
65 |
|
|
done
|
66 |
|
|
|
67 |
|
|
echo "Generating project files for simulation and synthesis..."
|
68 |
|
|
echo "__________________________________________________________________________"
|
69 |
|
|
echo ""
|
70 |
|
|
make -C $MINSOC_DIR/prj
|
71 |
|
|
echo "Generation complete."
|
72 |
|
|
echo ""
|
73 |
|
|
echo ""
|
74 |
|
|
|
75 |
|
|
if [ $CONSTRAINT_FILE == 'NONE' ]
|
76 |
|
|
then
|
77 |
|
|
echo "Skipping synthesis preparation. Standard implementation can only be simulated."
|
78 |
|
|
echo ""
|
79 |
|
|
echo ""
|
80 |
|
|
else
|
81 |
|
|
echo "Device part and family for files under $SYNSRC_DIR will patched and stored "
|
82 |
|
|
echo "temporarily."
|
83 |
|
|
echo "Afterwards, they are copied to $SYNSUPPORT_DIR."
|
84 |
|
|
echo "__________________________________________________________________________"
|
85 |
|
|
echo ""
|
86 |
|
|
sed "s/$FIND_PART/$DEVICE_PART/g" $MAKEFILE_DIR/$PROJECT_FILE > TMPFILE
|
87 |
|
|
sed "s/$FIND_FAMILY/$FAMILY_PART/g" TMPFILE > TMPFILE2
|
88 |
|
|
#sed "s/$FIND_VERSION/$SW_VERSION/g" TMPFILE> TMPFILE
|
89 |
|
|
echo "Adding settings from constraint file..."
|
90 |
|
|
cat $CONSTRAINT_FILE >> TMPFILE2
|
91 |
|
|
|
92 |
|
|
echo "Generating quartus settings from prj files in $SYNSRC_DIR"
|
93 |
|
|
for file in "${SYN_FILES[@]}"
|
94 |
|
|
do
|
95 |
|
|
echo "Adding settings from file $file..."
|
96 |
|
|
cat $SYNSRC_DIR/$file >> TMPFILE2
|
97 |
|
|
done
|
98 |
|
|
mv TMPFILE2 $SYNSUPPORT_DIR/$PROJECT_FILE
|
99 |
|
|
rm TMPFILE
|
100 |
|
|
echo ""
|
101 |
|
|
echo "Generated quartus settings file in $SYNSUPPORT_DIR/$PROJECT_FILE"
|
102 |
|
|
echo ""
|
103 |
|
|
|
104 |
|
|
echo "Copying Makefile from $MAKEFILE_DIR to synthesis directory, $SYN_DIR..."
|
105 |
|
|
cp $MAKEFILE_DIR/$MAKEFILE $SYN_DIR/$MAKEFILE
|
106 |
|
|
cp $MAKEFILE_DIR/setup.bat $SYN_DIR/setup.bat
|
107 |
|
|
echo "For synthesis help go to $SYN_DIR and type \"make\"."
|
108 |
|
|
echo ""
|
109 |
|
|
echo ""
|
110 |
|
|
fi
|
111 |
|
|
|
112 |
|
|
#Precompiling firmwares
|
113 |
|
|
echo "Precompiling delivered libraries and firmwares..."
|
114 |
|
|
make -C ../../sw/utils
|
115 |
|
|
make -C ../../sw/support
|
116 |
|
|
make -C ../../sw/drivers
|
117 |
|
|
make -C ../../sw/uart
|
118 |
|
|
make -C ../../sw/jsp
|
119 |
|
|
make -C ../../sw/eth
|
120 |
|
|
echo "done."
|
121 |
|
|
echo ""
|
122 |
|
|
echo ""
|
123 |
|
|
|
124 |
|
|
echo "Configuration done."
|