Fixed reference design for ML605 revE
[reconos.git] / tools / reconos_setup.sh
blob8dab78ee65c4b9017781db504fd49b17088d8e43
1 #!/bin/sh
3 # ____ _____
4 # ________ _________ ____ / __ \/ ___/
5 # / ___/ _ \/ ___/ __ \/ __ \/ / / /\__ \
6 # / / / __/ /__/ /_/ / / / / /_/ /___/ /
7 # /_/ \___/\___/\____/_/ /_/\____//____/
8 #
9 # ======================================================================
11 # project: ReconOS
12 # author: Christoph RĂ¼thing, University of Paderborn
13 # description: The setup script to generate a complete EDK-Project
14 # from a base design, ther ReconOS components and the
15 # users HWTs.
17 # ======================================================================
19 set -e
21 if [ $# -ne 1 ]
22 then
23 echo "ERROR: No configuration file specified"
24 exit
27 echo "Generating EDK Projekt ..."
29 # source the specified configuration file
30 if [ ! -f $1 ]
31 then
32 echo "ERROR: Configuration file not found"
33 exit
35 . ./$1
37 if [ -z "$num_reconf_hwts" ]
38 then
39 num_reconf_hwts=0
40 num_reconf_regions=0
42 if [ -z "$num_static_hwts" ]
43 then
44 num_static_hwts=0
46 if [ $num_reconf_regions -gt 14 ]
47 then
48 echo "WARNING: you have specified more than 14 reconfigurable regions."
49 echo " Since the default ucf contains only presets for 14 reconfigurable regions"
50 echo " you must specify your own area groups."
53 num_hwts=$(($num_static_hwts+$num_reconf_regions))
55 echo "Copying base design and ReconOS hardware ..."
57 edk=edk_${RECONOS_ARCH}_${RECONOS_OS}
59 # copy base design and pcores
60 cp -r ${RECONOS}/designs/${RECONOS_ARCH}_${RECONOS_OS}_${base_design} $edk
61 mkdir -p $edk/pcores
62 cp -r ${RECONOS}/pcores/* $edk/pcores
64 echo "Generating ReconOS system ..."
66 # generate all files
67 find $edk/pcores -type f -exec reconos_preproc.sh {} $num_hwts {} \;
69 echo "Linking in HWTs ..."
71 # link HWTs to EDK
72 cd $edk/pcores
74 for hwt in $static_hwts
76 ln -sf ../../${hwt%#*} .
77 done
79 for hwt in $reconf_hwts
81 ln -sf ../../${hwt%#*} .
82 done
84 cd ../..
86 # generate mhs
87 cd $edk
89 mv system.mhs system.mhs.orig
91 if [ $num_reconf_hwts -ne 0 ]
92 then
93 # create mhs files
94 python ${RECONOS}/tools/python/mhsaddhwts.py "-reconf" $RECONOS_ARCH system.mhs.orig $num_static_hwts $num_reconf_regions $static_hwts "reconos_hwt_idle_v1_00_a" > system_static.mhs
95 ln -s system_static.mhs system.mhs
97 for hwt in $reconf_hwts
99 python ${RECONOS}/tools/python/mhsaddhwts.py "-reconf" $RECONOS_ARCH system.mhs.orig $num_static_hwts $num_reconf_regions $static_hwts $hwt > system_reconf_$hwt.mhs
100 done
102 # create system.ucf
103 for i in $(seq 0 $(($num_reconf_regions-1)))
105 sed -i "s/#INST \"hwt_reconf_$i\"/INST \"hwt_reconf_$i\"/" data/system.ucf
106 sed -i "s/#AREA_GROUP \"pblock_hwt_reconf_$i\"/AREA_GROUP \"pblock_hwt_reconf_$i\"/" data/system.ucf
107 done
108 else
109 # create mhs file
110 if $RECONOS_MMU
111 then
112 python ${RECONOS}/tools/python/mhsaddhwts.py $RECONOS_ARCH system.mhs.orig $num_static_hwts 0 $static_hwts > system.mhs
113 else
114 python ${RECONOS}/tools/python/mhsaddhwts.py "-nommu" $RECONOS_ARCH system.mhs.orig $num_static_hwts 0 $static_hwts > system.mhs
118 if [ -f setup.sh ]
119 then
120 ./setup.sh