annotate gsm-fw/cfgmagic/processconf.sh @ 163:5e0e41cd7c9f

gsm-fw/bsp/sim*.c: initial import from the Leonardo semi-src
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 18 Nov 2013 01:37:19 +0000
parents afceeeb2cba1
children df335d255ac4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 #!/bin/sh
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 # The top level Makefile invokes this Bourne shell script after ensuring
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 # that the build.conf file is present. The job of this script is to grok
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 # that configuration file and to produce include/config.{h,mk,m4} files
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 # corresponding to the selected configuration.
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 #
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 # The current directory is expected to be the top level of nuc-fw, i.e.,
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 # all fragments are sourced as cfgmagic/blah.
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 # Don't run this script directly - let the Makefile do it for you.
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 set -e
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 . cfgmagic/functions
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 TARGET=
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 c_export_list=
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 mk_export_list=
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 m4_export_list=
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17
122
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
18 # some defaults
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
19 RVTMUX_UART_port=IrDA
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
20 RVTMUX_UART_baud=115200
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
21
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 . ./build.conf
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 if [ -z "$TARGET" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 echo "Error: target not set in build.conf" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29
122
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
30 # Serial configuration
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
31 case "$RVTMUX_UART_port" in
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
32 IrDA)
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
33 ;;
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
34 MODEM)
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
35 CONFIG_RVTMUX_ON_MODEM=1
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
36 export_to_c CONFIG_RVTMUX_ON_MODEM
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
37 ;;
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
38 *)
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
39 echo "Error: unknown RTVMUX_UART_port=$RTVMUX_UART_port" 1>&2
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
40 exit 1
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
41 ;;
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
42 esac
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
43
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
44 TR_BAUD_CONFIG=TR_BAUD_$RVTMUX_UART_baud
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
45 export_to_c TR_BAUD_CONFIG
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
46
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 # Once we get some actual functionality, the following definitions
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 # will likely depend on the target and feature configuration,
138
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 123
diff changeset
49 # but for now all we have is a Riviera skeleton.
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50
138
85994b210f6a nuc-fw cleanup: old Nucleus demo (w/o TI fw framework) moved out of the way
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 123
diff changeset
51 BUILD_COMPONENTS="bsp nucleus riviera serial sprintf sysglue"
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 export_to_mk BUILD_COMPONENTS
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 BUILD_DEFAULT_IMAGE=ramImage
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 export_to_mk BUILD_DEFAULT_IMAGE
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 # Now generate the output files!
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 parse_export_list() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 for var in $1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 do
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 eval "value=\"\$$var\""
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 emit_def "$var" "$value"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 done
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 # make config.h
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 emit_def() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 echo "#define $1 $2" >> include/config.h
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 : > include/config.h
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 parse_export_list "$c_export_list"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 # make config.mk
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 emit_def() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76 echo "$1= $2" >> include/config.mk
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 : > include/config.mk
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 parse_export_list "$mk_export_list"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 # make config.m4
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 emit_def() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83 echo 'define(`'"$1'"',`'"$2')dnl" >> include/config.m4
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 : > include/config.m4
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 parse_export_list "$m4_export_list"