FreeCalypso > hg > fc-tourmaline
comparison configure.sh @ 34:32a6a9833bd6
configure.sh: putting it all together
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 17 Oct 2020 03:26:12 +0000 |
parents | |
children | e58a5bb12de4 |
comparison
equal
deleted
inserted
replaced
33:94ee95dad595 | 34:32a6a9833bd6 |
---|---|
1 #!/bin/sh | |
2 | |
3 set -e | |
4 | |
5 if [ ! -f configure.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 2 ] | |
28 then | |
29 echo "usage: $0 [--clean] target config [vars]" 1>&2 | |
30 exit 1 | |
31 fi | |
32 | |
33 TARGET="$1" | |
34 CONFIG="$2" | |
35 | |
36 if [ ! -f "targets/$TARGET.conf" -o ! -f "targets/$TARGET.h" ] | |
37 then | |
38 echo "Error: target $TARGET not known" 1>&2 | |
39 exit 1 | |
40 fi | |
41 | |
42 if [ ! -f "configs/$CONFIG" ] | |
43 then | |
44 echo "Error: configuration $CONFIG not known" 1>&2 | |
45 exit 1 | |
46 fi | |
47 | |
48 # target defaults that can be overridden by $TARGET.conf | |
49 | |
50 CHIPSET=10 | |
51 DSP=36 | |
52 RF=12 | |
53 DISABLE_SLEEP=0 | |
54 FCHG_STATE=0 | |
55 RVTMUX_ON_MODEM=0 | |
56 | |
57 . "targets/$TARGET.conf" | |
58 | |
59 # settings derived from the target-defined DSP version | |
60 | |
61 case "$DSP" in | |
62 33) | |
63 AMR=0 | |
64 L1_DYN_DSP_DWNLD=0 | |
65 L1_VOICE_MEMO_AMR=0 | |
66 MELODY_E2=0 | |
67 SPEECH_RECO=0 | |
68 ;; | |
69 34) | |
70 AMR=1 | |
71 L1_DYN_DSP_DWNLD=0 | |
72 L1_VOICE_MEMO_AMR=0 | |
73 MELODY_E2=0 | |
74 SPEECH_RECO=0 | |
75 ;; | |
76 36) | |
77 AMR=1 | |
78 L1_DYN_DSP_DWNLD=1 | |
79 L1_VOICE_MEMO_AMR=1 | |
80 MELODY_E2=1 | |
81 SPEECH_RECO=1 | |
82 ;; | |
83 *) | |
84 echo "Error: DSP=$DSP setting not understood" 1>&2 | |
85 exit 1 | |
86 esac | |
87 | |
88 # functional configuration part | |
89 | |
90 # these vars MUST be set by the functional config | |
91 GPRS= | |
92 MMI= | |
93 R2D_STATE= | |
94 SRVC= | |
95 | |
96 # dummy defaults for sans-UI configs | |
97 R2D_EMBEDDED_LCD=7 | |
98 UI_CONFIG=bigcolor | |
99 | |
100 # apply functional config | |
101 | |
102 . "configs/$CONFIG" | |
103 | |
104 # verify it | |
105 | |
106 if [ -z "$GPRS" ] | |
107 then | |
108 echo "Error: configs/$CONFIG must set GPRS=" 1>&2 | |
109 exit 1 | |
110 fi | |
111 | |
112 if [ -z "$MMI" ] | |
113 then | |
114 echo "Error: configs/$CONFIG must set MMI=" 1>&2 | |
115 exit 1 | |
116 fi | |
117 | |
118 if [ -z "$R2D_STATE" ] | |
119 then | |
120 echo "Error: configs/$CONFIG must set R2D_STATE=" 1>&2 | |
121 exit 1 | |
122 fi | |
123 | |
124 if [ -z "$SRVC" ] | |
125 then | |
126 echo "Error: configs/$CONFIG must set SRVC=" 1>&2 | |
127 exit 1 | |
128 fi | |
129 | |
130 if [ "$MMI" != 0 ] | |
131 then | |
132 FCHG_STATE=1 | |
133 fi | |
134 | |
135 # miscellaneous configurable feature settings | |
136 | |
137 ALLOW_CSIM_GSM=1 | |
138 OSL=0 | |
139 OSX=0 | |
140 SERIAL_DYNAMIC_SWITCH=0 | |
141 TI_PROFILER=0 | |
142 TRACEMASK_IN_FFS=0 | |
143 TR_BAUD_CONFIG=TR_BAUD_115200 | |
144 USE_STR2IND=0 | |
145 | |
146 SUFFIX= | |
147 | |
148 # allow the user to override these defaults | |
149 | |
150 shift | |
151 shift | |
152 while [ $# != 0 ] | |
153 do | |
154 eval "$1" | |
155 shift | |
156 done | |
157 | |
158 BUILD_DIR="build-$TARGET-$CONFIG$SUFFIX" | |
159 | |
160 echo "Building configuration $CONFIG for target $TARGET in $BUILD_DIR" | |
161 | |
162 if [ "$clean_flag" = 1 ] | |
163 then | |
164 rm -rf $BUILD_DIR | |
165 fi | |
166 mkdir -p $BUILD_DIR | |
167 | |
168 : > $BUILD_DIR/lcfgen | |
169 | |
170 # shell functions to be used in the configuration recipe | |
171 | |
172 build_lib() { | |
173 if [ $# != 1 ] | |
174 then | |
175 echo "Error: build_lib takes 1 argument" 1>&2 | |
176 exit 1 | |
177 fi | |
178 scripts/mk-component.sh "$1" | |
179 SUBDIR="$SUBDIR $1" | |
180 current_lib=$1/$1.lib | |
181 LIBS="$LIBS $current_lib" | |
182 } | |
183 | |
184 blob_lib() { | |
185 if [ $# != 1 ] | |
186 then | |
187 echo "Error: blob_lib takes 1 argument" 1>&2 | |
188 exit 1 | |
189 fi | |
190 current_lib="../blobs/$1.lib" | |
191 LIBS="$LIBS $current_lib" | |
192 } | |
193 | |
194 lib_link_magic() { | |
195 if [ $# != 1 ] | |
196 then | |
197 echo "Error: lib_link_magic takes 1 argument" 1>&2 | |
198 exit 1 | |
199 fi | |
200 if [ -z "$current_lib" ] | |
201 then | |
202 echo "Error: lib_link_magic called before build_lib or blob_lib" 1>&2 | |
203 exit 1 | |
204 fi | |
205 SPECIAL_LINK_LIBS="$SPECIAL_LINK_LIBS $current_lib" | |
206 echo "$1" >> $BUILD_DIR/lcfgen | |
207 } | |
208 | |
209 # invoke the configuration recipe | |
210 | |
211 export BUILD_DIR TARGET USE_STR2IND | |
212 export CHIPSET DSP RF | |
213 export AMR L1_DYN_DSP_DWNLD L1_VOICE_MEMO_AMR MELODY_E2 SPEECH_RECO | |
214 export DISABLE_SLEEP | |
215 export FCHG_STATE R2D_STATE | |
216 export GPRS MMI SRVC RVTMUX_ON_MODEM | |
217 export R2D_EMBEDDED_LCD UI_CONFIG | |
218 export ALLOW_CSIM_GSM SERIAL_DYNAMIC_SWITCH TR_BAUD_CONFIG | |
219 export TI_PROFILER TRACEMASK_IN_FFS | |
220 export OSL | |
221 | |
222 scripts/config-headers.sh | |
223 | |
224 SUBDIR= | |
225 LIBS= | |
226 SPECIAL_LINK_LIBS= | |
227 current_lib= | |
228 | |
229 build_lib ccddata | |
230 | |
231 # ACI libs | |
232 build_lib aci | |
233 build_lib aciext | |
234 build_lib aci_dti_mng | |
235 build_lib atiext | |
236 build_lib comlib | |
237 | |
238 if [ "$GPRS" = 1 ] | |
239 then | |
240 build_lib config_gprs_fl | |
241 build_lib config_gprs_ir | |
242 else | |
243 build_lib config_gsm_fl | |
244 build_lib config_gsm_ir | |
245 fi | |
246 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))' | |
247 | |
248 # UI layers | |
249 if [ "$MMI" = 2 ] | |
250 then | |
251 build_lib bmi | |
252 build_lib icn | |
253 build_lib mfw | |
254 fi | |
255 | |
256 # G23M protocol stack libs | |
257 build_lib alr | |
258 build_lib cc | |
259 build_lib dl | |
260 build_lib dti | |
261 build_lib l1_pei | |
262 build_lib mm | |
263 build_lib rr | |
264 build_lib sim_b_lib | |
265 build_lib sms | |
266 build_lib ss | |
267 build_lib uart_b_lib | |
268 | |
269 # fax and data | |
270 if [ "$SRVC" != 0 ] | |
271 then | |
272 build_lib l2r | |
273 build_lib ra | |
274 build_lib rlp | |
275 fi | |
276 | |
277 # fax specific | |
278 if [ "$SRVC" = 1 ] | |
279 then | |
280 build_lib fad | |
281 build_lib t30 | |
282 fi | |
283 | |
284 # GPRS specific | |
285 if [ "$GPRS" = 1 ] | |
286 then | |
287 build_lib cci | |
288 build_lib cci_ir | |
289 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))' | |
290 build_lib cl | |
291 build_lib gmm | |
292 build_lib grlc | |
293 build_lib grlc_ir | |
294 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))' | |
295 build_lib grr | |
296 build_lib llc | |
297 build_lib sm | |
298 build_lib sndcp | |
299 build_lib ppp | |
300 build_lib ppp_ir | |
301 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))' | |
302 build_lib upm | |
303 fi | |
304 | |
305 # Condat drivers | |
306 build_lib gdi | |
307 | |
308 # GPF | |
309 build_lib ccd | |
310 build_lib frame_fl | |
311 build_lib frame_ir | |
312 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))' | |
313 | |
314 build_lib misc_fl | |
315 build_lib misc_ir | |
316 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))' | |
317 | |
318 if [ "$OSX" = 1 ] | |
319 then | |
320 build_lib osx | |
321 else | |
322 blob_lib osx_na7_db | |
323 fi | |
324 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))' | |
325 | |
326 build_lib tif_fl | |
327 build_lib tif_ir | |
328 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))' | |
329 | |
330 # core drivers | |
331 build_lib drivers_flash | |
332 | |
333 # Layer 1 | |
334 build_lib tpudrv | |
335 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))' | |
336 build_lib l1_ext | |
337 lib_link_magic '(BSS_LIBS (.l1s_global))' | |
338 build_lib l1_int | |
339 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))' | |
340 build_lib l1_custom_ext | |
341 build_lib l1_custom_int | |
342 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))' | |
343 | |
344 build_lib riviera_core_flash | |
345 build_lib riviera_cust_flash | |
346 | |
347 # services | |
348 build_lib audio | |
349 build_lib audio_bgd | |
350 build_lib cst | |
351 build_lib dar | |
352 build_lib dar_gbl_var | |
353 lib_link_magic '(BSS_DAR_LIB (.bss))' | |
354 build_lib etm | |
355 build_lib lls | |
356 | |
357 # app drivers | |
358 build_lib abb | |
359 build_lib buzzer | |
360 if [ "$FCHG_STATE" = 1 ] | |
361 then | |
362 build_lib fchg | |
363 fi | |
364 build_lib ffs | |
365 build_lib ffs_drv | |
366 build_lib ffs_pcm | |
367 build_lib kpd | |
368 build_lib power | |
369 if [ "$R2D_STATE" = 1 ] | |
370 then | |
371 build_lib r2d_drv_custom_flash | |
372 build_lib r2d_drv_flash | |
373 build_lib r2d_drv_int_ram | |
374 lib_link_magic '(CONST_LIBS (.text, .r2dlcd))' | |
375 fi | |
376 build_lib rtc_drv | |
377 build_lib sim_drv | |
378 build_lib spi_drv | |
379 build_lib uart_drv | |
380 | |
381 # system glue | |
382 build_lib main | |
383 build_lib bootloader | |
384 lib_link_magic '(CONST_BOOT_LIB (.const, .text, .text:v$3) BSS_BOOT_LIB (.bss))' | |
385 | |
386 # Nucleus | |
387 build_lib nucleus_flash | |
388 build_lib nucleus_intram | |
389 lib_link_magic '(BSS_LIBS (.bss) CONST_LIBS (.text, .const))' | |
390 | |
391 # TI's libc/libgcc equivalent | |
392 blob_lib rts16le_flash | |
393 blob_lib rts16le_int_ram | |
394 lib_link_magic '(BSS_LIBS (.bss))' | |
395 | |
396 # generate the top level Makefile! | |
397 | |
398 helpers/makeline def CONFIG_NAME "$CONFIG$SUFFIX" > $BUILD_DIR/Makefile | |
399 echo >> $BUILD_DIR/Makefile | |
400 helpers/makeline def TARGET $TARGET >> $BUILD_DIR/Makefile | |
401 echo >> $BUILD_DIR/Makefile | |
402 helpers/makeline def SUBDIR $SUBDIR >> $BUILD_DIR/Makefile | |
403 echo >> $BUILD_DIR/Makefile | |
404 helpers/makeline def LIBS $LIBS >> $BUILD_DIR/Makefile | |
405 echo >> $BUILD_DIR/Makefile | |
406 helpers/makeline def SPECIAL_LINK_LIBS $SPECIAL_LINK_LIBS >> $BUILD_DIR/Makefile | |
407 echo >> $BUILD_DIR/Makefile | |
408 helpers/makeline def LINK_SCRIPT_SRC ../$LINK_SCRIPT_SRC >> $BUILD_DIR/Makefile | |
409 echo >> $BUILD_DIR/Makefile | |
410 | |
411 if [ -n "$RAM_LINK_SCRIPT_SRC" ] | |
412 then | |
413 helpers/makeline def RAM_LINK_SCRIPT_SRC ../$RAM_LINK_SCRIPT_SRC \ | |
414 >> $BUILD_DIR/Makefile | |
415 echo >> $BUILD_DIR/Makefile | |
416 fi | |
417 | |
418 helpers/makeline def FLASH_BASE_ADDR $FLASH_BASE_ADDR >> $BUILD_DIR/Makefile | |
419 helpers/makeline def FLASH_SECTOR_SIZE $FLASH_SECTOR_SIZE >> $BUILD_DIR/Makefile | |
420 echo >> $BUILD_DIR/Makefile | |
421 | |
422 if [ "$USE_STR2IND" = 1 ] | |
423 then | |
424 helpers/makeline def STR2IND_OBJ str2ind.obj >> $BUILD_DIR/Makefile | |
425 else | |
426 echo 'STR2IND_OBJ=' >> $BUILD_DIR/Makefile | |
427 fi | |
428 echo >> $BUILD_DIR/Makefile | |
429 | |
430 cat makefile-frags/first-part >> $BUILD_DIR/Makefile | |
431 | |
432 if [ "$USE_STR2IND" = 1 ] | |
433 then | |
434 cat makefile-frags/str2ind >> $BUILD_DIR/Makefile | |
435 fi | |
436 | |
437 cat makefile-frags/link-steps >> $BUILD_DIR/Makefile | |
438 | |
439 case "$TARGET" in | |
440 c11x|c139|j100) | |
441 cat makefile-frags/m0-to-bin-c139 >> $BUILD_DIR/Makefile | |
442 ;; | |
443 c155) | |
444 cat makefile-frags/m0-to-bin-c155 >> $BUILD_DIR/Makefile | |
445 ;; | |
446 *) | |
447 cat makefile-frags/m0-to-bin-std >> $BUILD_DIR/Makefile | |
448 ;; | |
449 esac | |
450 | |
451 cat makefile-frags/flash-script-gen >> $BUILD_DIR/Makefile | |
452 | |
453 if [ -n "$RAM_LINK_SCRIPT_SRC" ] | |
454 then | |
455 cat makefile-frags/ram-link-steps >> $BUILD_DIR/Makefile | |
456 fi | |
457 | |
458 cat makefile-frags/clean-always >> $BUILD_DIR/Makefile | |
459 echo >> $BUILD_DIR/Makefile | |
460 echo 'FRC:' >> $BUILD_DIR/Makefile | |
461 | |
462 # All done! | |
463 | |
464 echo "Run make in $BUILD_DIR to compile the firmware" |