Skip to content
Newer
Older
100755 225 lines (165 sloc) 3.58 KB
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
1 ################################################################################
2 # Filename # build-rts.sh
3 # Purpose # Build the Zero-Footprint-Profile Runtime System.
4 # Description #
5 # Copyright # Luke A. Guest, David Rees Copyright (C) 2011
6 ################################################################################
7 #!/bin/sh
f64059e Added option to delete old build dirs, and reverse patches. Improved …
David Rees authored Feb 14, 2011
8 clear
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
9 source ./errors.inc
10
11 # This defines the boards we currently support. This will also define where
12 # the RTS is built.
c609c30 @Lucretia Fixed it to work with the GNAT project file.
authored Jan 9, 2012
13 BOARDS="stm32f4"
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
14
15 function list_boards()
16 {
f64059e Added option to delete old build dirs, and reverse patches. Improved …
David Rees authored Feb 14, 2011
17 echo " Boardname is one of:"
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
18
19 for b in $BOARDS
20 do
21 echo " $b"
22 done
23 }
24
f64059e Added option to delete old build dirs, and reverse patches. Improved …
David Rees authored Feb 14, 2011
25 if [ ! -f ./config.inc ]; then
26
27 cat << 'NOCONFIG_ERR'
28
29 ERROR: No config.inc found.
30
31 1) cp config-master.inc config.inc
32 2) Edit config.inc for your system
33 3) ./build-tools.sh
34 4) Run this script again
35
36 NOCONFIG_ERR
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
37
38 exit 2
f64059e Added option to delete old build dirs, and reverse patches. Improved …
David Rees authored Feb 14, 2011
39
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
40 else
41 source ./config.inc
42 fi
43
1f14933 @Lucretia Can now build an RTS for Cortex-M4.
authored Jan 10, 2012
44 if [ $# == 0 ]
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
45 then
f64059e Added option to delete old build dirs, and reverse patches. Improved …
David Rees authored Feb 14, 2011
46 echo " Usage:"
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
47 echo " ./build-rts.sh <boardname>"
1f14933 @Lucretia Can now build an RTS for Cortex-M4.
authored Jan 10, 2012
48 echo " or"
49 echo " ./build-rts.sh <boardname> rebuild"
50 echo " or"
51 echo " ./build-rts.sh clean"
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
52 echo ""
53
54 list_boards
55
56 exit 2
57 fi
58
f64059e Added option to delete old build dirs, and reverse patches. Improved …
David Rees authored Feb 14, 2011
59 echo " Creating RTS with GCC-$GCC_VERSION for '$1' board"
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
60
b7ba8bf @nosey Add additional languages and arithmetic libs to native toolchain. Sep…
nosey authored Jan 6, 2012
61 export PATH=$INSTALL_DIR/bin:$PATH
c609c30 @Lucretia Fixed it to work with the GNAT project file.
authored Jan 9, 2012
62 export LD_LIBRARY_PATH=$INSTALL_DIR/lib:$INSTALL_DIR/lib$BITS:$LD_LIBRARY_PATH
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
63
64 RTS=$TOP/../rts
65
66
67 # $1 = board name
68 function check_board_name()
69 {
70 if [[ ! $BOARDS =~ $1 ]]
71 then
f64059e Added option to delete old build dirs, and reverse patches. Improved …
David Rees authored Feb 14, 2011
72 echo " ERROR: Incorrect board name selected"
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
73 echo ""
74
75 list_boards
76
77 exit 2
78 fi
79 }
80
ccf6739 @Lucretia Create the directories automatically.
authored Feb 13, 2011
81 function create_dirs()
82 {
83 cd $RTS
84
2a4fb5c @Lucretia Re-organised the build script to clean out the objs dir after each bu…
authored Feb 13, 2011
85 echo " >> Creating RTS dirs..."
ccf6739 @Lucretia Create the directories automatically.
authored Feb 13, 2011
86
87 if [ ! -d obj ]
88 then
89 mkdir -p obj
90 fi
91
92 if [ ! -d boards ]
93 then
94 mkdir -p boards
95 fi
96
97 for b in $BOARDS
98 do
99 if [ ! -d boards/$b ]
100 then
101 mkdir -p boards/$b/adainclude
102 mkdir -p boards/$b/adalib
103 fi
104 done
105 }
106
541428c @Lucretia Added more restrictions to the Xpresso system.ads and changed the def…
authored Apr 8, 2011
107 # i-c.ads i-c.adb
108 SPECS="ada.ads a-unccon.ads a-uncdea.ads gnat.ads g-souinf.ads interfac.ads s-stoele.ads s-atacco.ads s-maccod.ads"
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
109 BODIES="s-stoele.adb s-atacco.adb"
110
111 # function copy_rts_files()
112 # {
113 # if [ ! -f $RTS/.rts_copied ]
114 # then
115 # FILES="$SPECS $BODIES"
116
117 # for f in $FILES
118 # do
119 # echo " >> Copying $GCC_DIR/gcc/ada/$f to $RTS/src/common..."
120
121 # cp $GCC_DIR/gcc/ada/$f $RTS/src/common
122
123 # check_error_exit
124 # done
125
126 # check_error $RTS/.rts_copied
127 # fi
128 # }
129
130 # $1 = board name
131 function create_symlinks()
132 {
133 cd $RTS/boards/$1/adainclude
134
135 if [ ! -f .symlinks ]
136 then
137 FILES=$SPECS
138
139 for f in $FILES
140 do
141 echo " >> Linking $f to $RTS/src/common/$f..."
142
143 ln -s $RTS/src/common/$f $f
144
145 check_error_exit
146 done
147
1f14933 @Lucretia Can now build an RTS for Cortex-M4.
authored Jan 10, 2012
148 FILES=$BODIES
149
150 for f in $FILES
151 do
152 echo " >> Linking $f to $RTS/src/common/$f..."
153
154 ln -s $RTS/src/common/$f $f
155
156 check_error_exit
157 done
158
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
159 echo " >> Linking system.ads to $RTS/src/boards/$1/system.ads..."
160
161 ln -s $RTS/src/boards/$1/system.ads system.ads
162
163 check_error .symlinks
164 fi
165 }
166
167 # $1 = board name
168 function build_rts()
169 {
c609c30 @Lucretia Fixed it to work with the GNAT project file.
authored Jan 9, 2012
170 # export PATH=$INSTALL_DIR/bin:$PATH
171 # export LD_LIBRARY_PATH=$INSTALL_DIR/lib$BITS:$LD_LIBRARY_PATH
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
172
173 cd $RTS
174
175 GNATMAKE=""
176
177 case $1 in
178 "pc")
179 GNATMAKE="gnatmake"
180 ;;
c609c30 @Lucretia Fixed it to work with the GNAT project file.
authored Jan 9, 2012
181 "stm32f4")
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
182 GNATMAKE="arm-none-eabi-gnatmake"
183 ;;
184 esac
185
1f14933 @Lucretia Can now build an RTS for Cortex-M4.
authored Jan 10, 2012
186 FLAGS="-gnatf -gnatv"
187
188 # $GNATMAKE --RTS=$RTS/boards/$1 -XBoard=$1 -Pgnat.gpr
2a4fb5c @Lucretia Re-organised the build script to clean out the objs dir after each bu…
authored Feb 13, 2011
189
1f14933 @Lucretia Can now build an RTS for Cortex-M4.
authored Jan 10, 2012
190 BOARD=$1 make
2a4fb5c @Lucretia Re-organised the build script to clean out the objs dir after each bu…
authored Feb 13, 2011
191 }
192
193
194 function clean_objs()
195 {
196 cd $RTS
197
198 rm obj/*
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
199 }
200
201
202 # copy_rts_files
203
1f14933 @Lucretia Can now build an RTS for Cortex-M4.
authored Jan 10, 2012
204 if [ $1 = "clean" ]
205 then
206 rm -rf obj
207 rm -rf boards
208 else
209 if [ $2 = "rebuild" ]
210 then
211 cd $RTS
212
213 BOARD=$1 make clean
214 fi
215
216 check_board_name $1
217 create_dirs
218 create_symlinks $1
219 echo "Using : " `which arm-none-eabi-gnatmake`
220 build_rts $1
221 clean_objs
222 fi
c499a6b @Lucretia New script to build the RTS for a bare metal compiler.
authored Feb 13, 2011
223
224 cd $TOP
Something went wrong with that request. Please try again.