comparison configure-tms470.sh @ 98:5fe5853f4e63

old configure.sh script is now configure-tms470.sh
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 21 Jul 2018 02:23:48 +0000
parents configure.sh@e955d102e7c4
children 5c4db73d289a
comparison
equal deleted inserted replaced
97:80e3a78126ac 98:5fe5853f4e63
1 #!/bin/sh
2
3 set -e
4
5 if [ ! -f configure-tms470.sh ]
6 then
7 echo "This script needs to be run from the top of the source tree" 1>&2
8 exit 1
9 fi
10
11 if [ ! -f helpers/makeline ]
12 then
13 echo "Please run make in the helpers directory first" 1>&2
14 exit 1
15 fi
16
17 # start looking at our invokation line
18
19 if [ "$1" = --clean ]
20 then
21 clean_flag=1
22 shift
23 else
24 clean_flag=0
25 fi
26
27 if [ $# -lt 1 ]
28 then
29 echo "usage: $0 [--clean] target [vars]" 1>&2
30 exit 1
31 fi
32
33 TARGET="$1"
34
35 if [ ! -f "targets/$TARGET.conf" -o ! -f "targets/$TARGET.h" ]
36 then
37 echo "Error: target $TARGET not known" 1>&2
38 exit 1
39 fi
40
41 # target defaults that can be overridden by $TARGET.conf
42
43 CHIPSET=10
44 DSP=36
45 RF=12
46 DISABLE_SLEEP=0
47
48 . "targets/$TARGET.conf"
49
50 BUILD_DIR="build-$TARGET-tms470"
51
52 # settings derived from the target-defined DSP version
53
54 case "$DSP" in
55 33)
56 AMR=0
57 L1_DYN_DSP_DWNLD=0
58 L1_VOICE_MEMO_AMR=0
59 MELODY_E2=0
60 SPEECH_RECO=0
61 ;;
62 34)
63 AMR=1
64 L1_DYN_DSP_DWNLD=0
65 L1_VOICE_MEMO_AMR=0
66 MELODY_E2=0
67 SPEECH_RECO=0
68 ;;
69 36)
70 AMR=1
71 L1_DYN_DSP_DWNLD=1
72 L1_VOICE_MEMO_AMR=1
73 MELODY_E2=1
74 SPEECH_RECO=1
75 ;;
76 *)
77 echo "Error: DSP=$DSP setting not understood" 1>&2
78 exit 1
79 esac
80
81 # miscellaneous configurable feature settings
82
83 ALLOW_CSIM_GSM=1
84 SERIAL_DYNAMIC_SWITCH=0
85 TR_BAUD_CONFIG=TR_BAUD_115200
86
87 # allow the user to override these defaults
88
89 shift
90 while [ $# != 0 ]
91 do
92 eval "$1"
93 shift
94 done
95
96 echo "Building firmware for target $TARGET in $BUILD_DIR"
97
98 if [ "$clean_flag" = 1 ]
99 then
100 rm -rf $BUILD_DIR
101 fi
102 mkdir -p $BUILD_DIR
103
104 : > $BUILD_DIR/lcfgen
105
106 # shell functions to be used in the configuration recipe
107
108 build_lib() {
109 if [ $# != 1 ]
110 then
111 echo "Error: build_lib takes 1 argument" 1>&2
112 exit 1
113 fi
114 scripts/mk-component.sh "$1"
115 SUBDIR="$SUBDIR $1"
116 current_lib=$1/$1.lib
117 LIBS="$LIBS $current_lib"
118 }
119
120 rts_blob_lib() {
121 if [ $# != 1 ]
122 then
123 echo "Error: rts_blob_lib takes 1 argument" 1>&2
124 exit 1
125 fi
126 current_lib="../tms470/rts/$1.lib"
127 LIBS="$LIBS $current_lib"
128 }
129
130 lib_link_magic() {
131 if [ $# != 1 ]
132 then
133 echo "Error: lib_link_magic takes 1 argument" 1>&2
134 exit 1
135 fi
136 if [ -z "$current_lib" ]
137 then
138 echo "Error: lib_link_magic called before build_lib or blob_lib" 1>&2
139 exit 1
140 fi
141 SPECIAL_LINK_LIBS="$SPECIAL_LINK_LIBS $current_lib"
142 echo "$1" >> $BUILD_DIR/lcfgen
143 }
144
145 # invoke the configuration recipe
146
147 export BUILD_DIR TARGET
148 export CHIPSET DSP RF
149 export AMR L1_DYN_DSP_DWNLD L1_VOICE_MEMO_AMR MELODY_E2 SPEECH_RECO
150 export DISABLE_SLEEP
151 export ALLOW_CSIM_GSM SERIAL_DYNAMIC_SWITCH TR_BAUD_CONFIG
152 export GPRS SRVC FCHG_STATE
153
154 scripts/config-headers.sh
155
156 SUBDIR=
157 LIBS=
158 SPECIAL_LINK_LIBS=
159 current_lib=
160
161 build_lib ccddata
162
163 # ACI libs
164 build_lib aci
165 build_lib aciext
166 build_lib aci_dti_mng
167 build_lib atiext
168 build_lib comlib
169
170 if [ "$GPRS" = 1 ]
171 then
172 build_lib config_gprs_fl
173 build_lib config_gprs_ir
174 else
175 build_lib config_gsm_fl
176 build_lib config_gsm_ir
177 fi
178 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))'
179
180 # G23M protocol stack libs
181 build_lib alr
182 build_lib cc
183 build_lib dl
184 build_lib dti
185 build_lib l1_pei
186 build_lib mm
187 build_lib rr
188 build_lib sim_b_lib
189 build_lib sms
190 build_lib ss
191 build_lib uart_b_lib
192
193 # fax and data
194 if [ "$SRVC" != 0 ]
195 then
196 build_lib l2r
197 build_lib ra
198 build_lib rlp
199 fi
200
201 # fax specific
202 if [ "$SRVC" = 1 ]
203 then
204 build_lib fad
205 build_lib t30
206 fi
207
208 # GPRS specific
209 if [ "$GPRS" = 1 ]
210 then
211 build_lib cci
212 build_lib cci_ir
213 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))'
214 build_lib cl
215 build_lib gmm
216 build_lib grlc
217 build_lib grlc_ir
218 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))'
219 build_lib grr
220 build_lib llc
221 build_lib sm
222 build_lib sndcp
223 build_lib ppp
224 build_lib ppp_ir
225 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))'
226 build_lib upm
227 fi
228
229 # Condat drivers
230 build_lib gdi
231
232 # GPF
233 build_lib ccd_na7_db
234 build_lib frame_na7_db_fl
235 build_lib frame_na7_db_ir
236 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))'
237 build_lib misc_na7_db_fl
238 build_lib misc_na7_db_ir
239 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))'
240 build_lib osx_na7_db
241 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))'
242 build_lib tif_na7_db_fl
243 build_lib tif_na7_db_ir
244 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))'
245
246 # core drivers
247 build_lib drivers_flash
248
249 # Layer 1
250 build_lib tpudrv
251 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))'
252 build_lib l1_ext
253 lib_link_magic '(BSS_LIBS (.l1s_global))'
254 build_lib l1_int
255 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))'
256 build_lib l1_custom_ext
257 build_lib l1_custom_int
258 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))'
259
260 build_lib riviera_core_flash
261 build_lib riviera_cust_flash
262
263 # services
264 build_lib audio
265 build_lib audio_bgd
266 build_lib cst
267 build_lib dar
268 build_lib dar_gbl_var
269 lib_link_magic '(BSS_DAR_LIB (.bss))'
270 build_lib etm
271 build_lib lls
272
273 # app drivers
274 build_lib abb
275 build_lib buzzer
276 if [ "$FCHG_STATE" = 1 ]
277 then
278 build_lib fchg
279 fi
280 build_lib ffs
281 build_lib ffs_drv
282 build_lib ffs_pcm
283 build_lib kpd
284 build_lib power
285 build_lib rtc_drv
286 build_lib sim_drv
287 build_lib spi_drv
288 build_lib uart_drv
289
290 # system glue
291 build_lib main
292 build_lib bootloader
293 lib_link_magic '(CONST_BOOT_LIB (.const, .text, .text:v$3) BSS_BOOT_LIB (.bss))'
294
295 # Nucleus
296 build_lib nucleus_flash
297 build_lib nucleus_intram
298 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))'
299
300 # TI's libc/libgcc equivalent
301 rts_blob_lib rts16le_flash
302 rts_blob_lib rts16le_int_ram
303 lib_link_magic '(BSS_LIBS (.bss))'
304
305 # generate the top level Makefile!
306
307 helpers/makeline def SUBDIR $SUBDIR > $BUILD_DIR/Makefile
308 echo >> $BUILD_DIR/Makefile
309 helpers/makeline def LIBS $LIBS >> $BUILD_DIR/Makefile
310 echo >> $BUILD_DIR/Makefile
311 helpers/makeline def SPECIAL_LINK_LIBS $SPECIAL_LINK_LIBS >> $BUILD_DIR/Makefile
312 echo >> $BUILD_DIR/Makefile
313 helpers/makeline def LINK_SCRIPT_SRC ../$LINK_SCRIPT_SRC >> $BUILD_DIR/Makefile
314 echo >> $BUILD_DIR/Makefile
315
316 if [ -n "$RAM_LINK_SCRIPT_SRC" ]
317 then
318 helpers/makeline def RAM_LINK_SCRIPT_SRC ../$RAM_LINK_SCRIPT_SRC \
319 >> $BUILD_DIR/Makefile
320 echo >> $BUILD_DIR/Makefile
321 fi
322
323 helpers/makeline def FLASH_BASE_ADDR $FLASH_BASE_ADDR >> $BUILD_DIR/Makefile
324 helpers/makeline def FLASH_SECTOR_SIZE $FLASH_SECTOR_SIZE >> $BUILD_DIR/Makefile
325 echo >> $BUILD_DIR/Makefile
326
327 cat tms470/makefile-frags/first-part >> $BUILD_DIR/Makefile
328
329 cat tms470/makefile-frags/link-steps >> $BUILD_DIR/Makefile
330
331 if [ "$TARGET" != c139 -a "$TARGET" != c11x ]
332 then
333 cat tms470/makefile-frags/m0-to-bin-std >> $BUILD_DIR/Makefile
334 else
335 cat tms470/makefile-frags/m0-to-bin-c139 >> $BUILD_DIR/Makefile
336 fi
337
338 cat tms470/makefile-frags/flash-script-gen >> $BUILD_DIR/Makefile
339
340 if [ -n "$RAM_LINK_SCRIPT_SRC" ]
341 then
342 cat tms470/makefile-frags/ram-link-steps >> $BUILD_DIR/Makefile
343 fi
344
345 cat tms470/makefile-frags/clean-always >> $BUILD_DIR/Makefile
346 echo >> $BUILD_DIR/Makefile
347 echo 'FRC:' >> $BUILD_DIR/Makefile
348
349 # All done!
350
351 echo "Run make in $BUILD_DIR to compile the firmware"