94
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 FreeCalypso Magnetite firmware project
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ======================================
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3
|
373
|
4 As of A.D. 2018, FC Magnetite is the primary official Calypso firmware source
|
|
5 tree for the FreeCalypso family of projects. This maintained and evolving
|
|
6 source can be built in many different configurations for several different
|
|
7 hardware targets, and is currently used in the following ways:
|
94
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8
|
373
|
9 * The official production firmwares for our fully supported GSM+GPRS modem
|
|
10 products (FCDEV3B and the modem part of Openmoko devices) are built from
|
|
11 this source tree. See doc/Modem-configs for this mode of usage.
|
94
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12
|
373
|
13 * The work in progress toward a future complete FreeCalypso phone handset
|
|
14 (also known as a Libre Dumbphone) is being done in this source tree.
|
|
15 See doc/Handset-goal for more info about this project direction.
|
94
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16
|
373
|
17 * One can play with FreeCalypso and get a taste for it using certain hardware
|
|
18 that used to be readily available and which most people in the phone hacking
|
384
|
19 scene already have: Motorola C1xx and Pirelli DP-L10. Firmware images of the
|
|
20 "hacking toy" sort can be built for these devices from the present source
|
|
21 tree, and one can exercise most of the functions and capabilities of
|
373
|
22 FreeCalypso (with the notable exception of CSD and GPRS) on this historical
|
384
|
23 but available-to-most-people hardware. See doc/C1xx-Howto, doc/Pirelli-Howto
|
373
|
24 and doc/Voice-pseudo-modem for more information.
|
94
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 Functionality
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 =============
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 TI's GSM mobile station firmware architecture supports two ways in which the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 GSM device may be controlled: via AT commands from an external host and/or via
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 a local UI on devices with LCD & keypad hardware. (I said "and/or" because the
|
218
|
32 two mechanisms can coexist.) The code we got from TI (TCS211) is very solid
|
|
33 and mature in the modem configuration (control via AT commands only, no UI, no
|
|
34 battery management, no traditional handset on/off control), but the additional
|
373
|
35 code layers that are needed for handset products but not for modems came in a
|
218
|
36 very rough "proof of concept" condition, nowhere close to a usable product.
|
|
37
|
373
|
38 In FC Magnetite we further maintain and support the solid code base we got for
|
|
39 the modem functionality, and we are also working to improve the support for
|
|
40 handset products and bring it into a practically usable state. We have already
|
|
41 implemented an entirely new battery charging and discharge monitoring driver
|
|
42 that actually works on our target hw (of the two we got from TI, one was
|
|
43 bitrotten and the other was designed for charging hardware that is quite
|
|
44 different from what we are working with), and we shall hopefully start working
|
|
45 on the UI soon - see doc/Handset-goal for more info.
|
94
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46
|
373
|
47 Both TI's original modem fw (TCS211) and our recreation thereof in this
|
|
48 Magnetite project support not only voice calls and SMS, but also CSD, fax and
|
|
49 GPRS. This advanced functionality is fully supported on our own GSM MS
|
|
50 development board (FCDEV3B), where both Calypso UARTs are presented directly to
|
|
51 the developer, as well as on the embedded Calypso modem in Openmoko GTA01/02
|
|
52 smartphones, where the AT command channel with CSD, fax and GPRS capabilities
|
|
53 is connected to the phone's application processor.
|
94
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 Build system
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 ============
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 Even though FC Magnetite is essentially unchanged TCS211 code base and builds
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 using TI's proprietary TMS470 compiler under Wine, the build system is entirely
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 new. TI's TCS211 build system, called BuSyB, works by way of a Java tool
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 generating a customized makefile for each desired build configuration, based on
|
96
|
62 lots of magic contained in a big repository of XML files. There are a bunch of
|
|
63 Perl scripts involved as well. The Java tool that does the heavy lifting exists
|
94
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 only as compiled Java bytecode sans source, and the surrounding Perl scripts
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 aren't very understandable either. And the whole thing thoroughly assumes a
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 Windows environment (drive letters, backslashes, case-insensitive file system)
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 throughout. As a result, when working with TCS211 fw with its original build
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 system, we had to treat these BuSyB-generated makefiles almost as being blobs in
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 themselves: regenerating a makefile from XML magic required major effort, there
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 were some bugs in the makefile generation which we couldn't fix and thus we had
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 to edit the makefiles manually after each regeneration - it was an utter mess,
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 and absolutely not an acceptable way to build a forward-looking, community-
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 serving project.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 In FC Magnetite I have recreated the relevant parts of the TCS211 build system,
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 using Bourne shell magic instead of Java and XML. Just like TI's BuSyB, ours
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 is a makefile generation system: in order to compile the firmware in a
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 particular desired configuration, you run a shell script to select the config
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 you would like. This shell script will create a dedicated build directory tree
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 to fully contain this build, and populate it with generated Makefiles and some
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 other bits - then you go into the just-created build directory and run make
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 there. The source and build trees are thus cleanly separated. See
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 doc/Compiling for detailed instructions.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 Another key difference from our previous TCS211-based firmware offerings is that
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 even though we still have to run TI's compiler binaries under Wine, the Wine
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 invokation has been moved from the top (root) of the build process to the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 bottom leaves. With our previous TCS211-based works you would run Wine at the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 top, and then the entire build process would proceed in the Windows environment,
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 using Windows versions of make and other nonsense. Not so in FC Magnetite:
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 in this firmware project all shell scripts, Makefiles, Perl scripts and other
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 build system accessories run at the native Unix level, and Wine is only invoked
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 at the lowest level by individual tool wrappers: for example, TI's compiler
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 binary cl470.exe is encapsulated in a Unix shell script called cl470 that
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 invokes Wine to run the Windows binary, presenting the illusion of a native
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 Unix tool to all upper levels.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 As yet another defenestration measure, all source files are checked into this
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 tree with Unix line endings.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100
|
373
|
101 Two versions of the G23M protocol stack
|
|
102 =======================================
|
|
103
|
|
104 A major component of all functional firmware configurations is the mass of code
|
|
105 that implements layers 2 and 3 of the GSM+GPRS protocol stack, called G23M. In
|
|
106 FC Magnetite we have the option of using one of two different versions of this
|
|
107 key firmware component:
|
|
108
|
|
109 * The original G23M version from Openmoko: this version is believed to be very
|
|
110 stable because it has been used (successfully to the best of our knowledge)
|
|
111 by Openmoko, and it came from TI's TCS211 program that officially targeted
|
|
112 the Calypso chipset - but it exists only as binary object libraries with no
|
|
113 corresponding source. The lack of source means no ability to change the
|
|
114 feature configuration (what is enabled and what is disabled), very difficult
|
|
115 to debug if something does go wrong - all of the usual problems of software
|
|
116 without source.
|
|
117
|
|
118 * A newer version from TI's TCS3/LoCosto program. This version came to us in
|
|
119 the form of full C source, and because this fw component is chipset-
|
|
120 independent (unlike L1), we have successfully produced a TCS2/TCS3 hybrid in
|
|
121 which the new G23M code from TCS3.2 is grafted onto the chipsetsw foundation
|
|
122 from TCS211, which we have reconstructed into full C source form as well.
|
|
123
|
|
124 Each of the two G23M PS versions also has its own version of the Application
|
|
125 Control Interface (ACI) layer to go with it, which we call aci2 and aci3 -
|
|
126 except that in the case of ACI, we have the full source for both versions.
|
|
127
|
|
128 The new TCS2/TCS3 hybrid config is the way forward, as our goal is to have no
|
|
129 blobs in our firmware - having the full source is a prerequisite for maintaining
|
|
130 a software product. FC Magnetite supports building both configurations in order
|
|
131 to facilitate the transition, and as of this writing, we still need to add a few
|
|
132 bits to the new version of ACI in order to achieve 100% feature parity with
|
|
133 Openmoko.
|
|
134
|
|
135 Other blobs
|
94
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 ===========
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137
|
373
|
138 The TCS2/TCS3 hybrid firmware is built almost entirely from source; the only
|
|
139 components which are linked in the form of prebuilt libraries are GPF, Nucleus
|
|
140 and the TMS470 compiler's equivalent of libc/libgcc. It needs to be noted that
|
|
141 these components are so stable and configuration-independent that they were
|
|
142 used mostly in prebuilt library form even inside TI. In the case of GPF we've
|
|
143 got the corresponding source for most of the modules within those libs; for the
|
|
144 few modules for which the original source has been lost, we've already done a
|
|
145 rough first-draft reconstruction as part of our previous gcc-built GSM fw
|
|
146 efforts, and we only need to polish this reconstruction in order to have
|
|
147 deblobbed GPF in our mainline production fw. In the case of Nucleus we likewise
|
|
148 have another version of it in full source form which has been proven good in
|
|
149 other FreeCalypso firmware projects.
|
94
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150
|
373
|
151 The planned successor to FC Magnetite (tentative planned name Selenite) will
|
|
152 use the hybrid config for the G23M PS, deblobbed GPF and the source-enabled
|
|
153 version of Nucleus, resulting in blob-free firmware except for the proprietary
|
|
154 TMS470 compiler and its equivalent of libc/libgcc. Transition to building with
|
|
155 gcc (like in FreeCalypso Citrine) will follow afterward, completely exiting the
|
|
156 land of blobs and proprietary build tools.
|
94
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 Further reading
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 ===============
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 For various instructions and notes specific to this FreeCalypso Magnetite
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 firmware, look in the doc directory. For more information about the overall
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 FreeCalypso project and our hardware building aspirations, go to our website:
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 https://www.freecalypso.org/
|