1 |
93 |
javieralso |
#!/bin/bash
|
2 |
|
|
|
3 |
|
|
#new boards have to udpate this
|
4 |
|
|
BOARD=altera_3c25_board #this has to have the name of the directory this file is in
|
5 |
|
|
DEVICE_PART=EP3C25Q240C8
|
6 |
|
|
FAMILY_PART="Cyclone III"
|
7 |
|
|
CONSTRAINT_FILE='altera_3c25_board.ucf'
|
8 |
|
|
PROJECT_FILE=minsoc_top.qsf
|
9 |
|
|
#SW_VERSION=`quartus_map -v | grep Version`
|
10 |
|
|
#~new boards update
|
11 |
|
|
|
12 |
|
|
#system workings
|
13 |
|
|
MINSOC_DIR=`pwd`/../..
|
14 |
|
|
BACKEND_DIR=$MINSOC_DIR/backend
|
15 |
|
|
SYN_DIR=$MINSOC_DIR/syn
|
16 |
|
|
SYNSRC_DIR=$MINSOC_DIR/prj/altera
|
17 |
|
|
SYNSUPPORT_DIR=$SYN_DIR/buildSupport
|
18 |
|
|
MAKEFILE_DIR=$SYN_DIR/altera
|
19 |
|
|
|
20 |
|
|
SYN_FILES=(adv_dbg.prj altera_jtag.prj ethmac.prj or1k.prj uart16550.prj minsoc_top.prj)
|
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 "Configuring SoC board's specific files for firmware compilation, "
|
47 |
|
|
echo "testbench generation and synthesis."
|
48 |
|
|
echo "Firmware and testbench looks for board specific files under minsoc/backend."
|
49 |
|
|
echo "Synthesis work under minsoc/syn."
|
50 |
|
|
echo ""
|
51 |
|
|
echo ""
|
52 |
|
|
|
53 |
|
|
if [ $CONSTRAINT_FILE == 'NONE' ]
|
54 |
|
|
then
|
55 |
|
|
echo "Skipping synthesis preparation. Standard implementation can only be simulated."
|
56 |
|
|
else
|
57 |
|
|
echo "Device part for files under minsoc/prj/altera will be patched and stored "
|
58 |
|
|
echo "temporarily."
|
59 |
|
|
echo "Afterwards, they are copied to minsoc/syn/buildSupport."
|
60 |
|
|
echo "__________________________________________________________________________"
|
61 |
|
|
echo ""
|
62 |
|
|
echo "Generating quartus settings file from templates..."
|
63 |
|
|
sed "s/$FIND_PART/$DEVICE_PART/g" $SYNSRC_DIR/$PROJECT_FILE > TMPFILE
|
64 |
|
|
sed "s/$FIND_FAMILY/$FAMILY_PART/g" TMPFILE > TMPFILE2
|
65 |
|
|
#sed "s/$FIND_VERSION/$SW_VERSION/g" TMPFILE> TMPFILE
|
66 |
|
|
echo "Adding settings from constraint file..."
|
67 |
|
|
cat $CONSTRAINT_FILE >> TMPFILE2
|
68 |
|
|
|
69 |
|
|
for file in "${SYN_FILES[@]}"
|
70 |
|
|
do
|
71 |
|
|
echo "Adding settings from file $file..."
|
72 |
|
|
cat $SYNSRC_DIR/$file >> TMPFILE2
|
73 |
|
|
done
|
74 |
|
|
mv TMPFILE2 $SYN_DIR/$PROJECT_FILE
|
75 |
|
|
rm TMPFILE
|
76 |
|
|
echo ""
|
77 |
|
|
echo "Generated quartus settings file in $SYN_DIR/$PROJECT_FILE"
|
78 |
|
|
echo ""
|
79 |
|
|
|
80 |
|
|
echo "Updating Makefile file..."
|
81 |
|
|
echo "Copying Makefile to synthesis directory..."
|
82 |
|
|
cp $MAKEFILE_DIR/$MAKEFILE $SYN_DIR/$MAKEFILE
|
83 |
|
|
echo ""
|
84 |
|
|
|
85 |
|
|
echo "Copying board specific SoC files to backend directory."
|
86 |
|
|
echo "__________________________________________________________________________"
|
87 |
|
|
echo ""
|
88 |
|
|
for file in "${BOARD_FILES[@]}"
|
89 |
|
|
do
|
90 |
|
|
if [ $file != NONE ]
|
91 |
|
|
then
|
92 |
|
|
echo "Copying $file, to backend directory..."
|
93 |
|
|
cp $BOARD_DIR/$file $BACKEND_DIR
|
94 |
|
|
fi
|
95 |
|
|
done
|
96 |
|
|
echo ""
|
97 |
|
|
echo "Configuration done."
|
98 |
|
|
echo "For synthesis go to $SYN_DIR and type \"make\"."
|
99 |
|
|
fi
|
100 |
|
|
|