1 ==================================
2 HOWTO: Try out the 0cpm Firmerware
3 ==================================
5 Please read this entire document before getting started.
13 **Warning:** This is premature for most users. The 0cpm Firmerware is pre-alpha,
14 and not everything about it is working. Developers however, may enjoy
15 trying it. Some hardware work is involved, though.
17 **Platform:** The 0cpm Firmerware is developed on a `Grandstream BT-200`_, but its
18 configuration menus are already prepared for other models, and even
19 other manufacturers. If you cannot source a BT-200 anymore (they are
20 not sold any longer) then you may want to try another device, like
21 the GXP-1200 or a more advanced model with an EXT connector. The EXT
22 connector that I've seen is an externalised I2C connector. The GXP
23 and recent BT-200 platforms are all pretty much constant in structure,
24 their main differences being the wiring and the new LCD on the GXP
27 .. _`Grandstream BT-200` : http://devel.0cpm.org/firmerware/pix/bt200-twohalves.jpg
29 Chips supported in the 0cpm Firmerware
30 --------------------------------------
32 First, you may want to check a few things:
34 * The DSP chip is a TMS320VC5501PGF
35 * The Codec chip is a TLV320AIC20K
36 * The Network chip is a KSZ8842-16MQL
38 A few older models were different:
40 * BT-100 uses a tic54x DSP, which boots over SPI instead of I2C.
41 SPI is not a bus, making the development process less comfortable.
42 It is quite possible, though.
43 * Older BT-200 and GXP-2020 used RTL8019AS network chips, and possibly
44 an RTL8035SC switch. It should be trivial to add support for those,
45 although I've also seen very early devices with two network chips and
46 switching done in the DSP, that would be a bit harder.
49 Study the hardware information
50 ------------------------------
52 The documentation for the BT 200 is the most extensive, and since
53 it is similar to all other models, you should probably start there.
54 There are separate pages to describe the PCB_ and GPIO_. You may
55 also want to read a bit about the Connectors_ found on board.
56 Finally, I keep a `datasheet archive`_ for your reference. Please
57 spare my bandwidth by downloading the entire set to your local system
60 .. _PCB : http://reverse.0cpm.org/grandstream/pcb-bt200.html
62 .. _GPIO : http://reverse.0cpm.org/grandstream/gpio-bt200.html
64 .. _Connectors : http://reverse.0cpm.org/grandstream/connect.html
66 .. _`datasheet archive` : http://reverse.0cpm.org/grandstream/datasheet/
68 Setting up the hardware
69 =======================
71 Let's get the soldering iron out first.
74 Tip: Solder a switch in the powerline
75 -------------------------------------
77 The design of the phone is made to be always-on. You want to reset a lot more
78 often than designed though, so you probably should solder a switch in the 5V-side
79 of your phone's power supply. It's very simple but extremely useful.
83 Create your I2C bootstrapping setup
84 -----------------------------------
86 Get a number (up to eight) I2C EEPROMs of 64 kB each, and stack them
87 as shown below. You can connect most pins, as these constitute a bus,
88 but an exception must be made for the pins A0/A1/A2, which must each
89 have a differnt combination of ones and zeroes. I've used a Gray
90 coded addressing scheme, and could therebby set different values to
91 all pins without crossing wires and without even needing more wire
92 than the clipped-off or bent-aside address pins ``;-)``
94 .. figure:: pix/bootfloppy-i2c-busside.jpg
96 The "bus side" of the EEPROM stack simply connects all lines.
98 .. figure:: pix/bootfloppy-i2c-graycodedside.jpg
100 The "address side" of the EEPROM stack offers different values to A0/A1/A2.
102 The Gray code for this example would be:
117 Now solder a cable to the I2C connector on the phone's PCB. This
118 looks like a single line of 6 pins that are 2mm (!) apart:
131 The device normally boots with BOOTM[2:0] temporarily pulled to 011 during system reset, causing it to boot from the Flash chip on the PCB. When booting over I2C is preferred, the I2C EEPROMs can be connected as a consecutive address range. To activate this boot mode, BOOTM[2:0] must be set to 110, so pin 5 of J402 must be pulled high and pin 4 must be pulled low. The build environment for the 0cpm Firmerware constructs an image properly formatted for boot over I2C.
134 I've created a sequence of connectors that turned out to be really helpful::
137 phone I2C --------------< /----- EEPROM stack
139 B \----------------------- parport-i2c
141 The splits are made from 2x6 recptors for pin headers. I bent the pins so that
142 the same signals appear on adjacent pins; this is connector A:
144 =========== ===========
146 =========== ===========
153 =========== ===========
155 And this is connector B:
157 =========== ===========
159 =========== ===========
164 =========== ===========
166 The bootkey can be inserted to boot from the I2C EEPROM stack, or
167 retracted to boot the standard firmware. Being able to do the
168 latter is a big help if you are ever in doubt whether you've
169 destroyed the hardware. If you did, usually you've pulled a
170 connector loose, or pushed so hard on pins that they've flown
171 to touch each other. In the latter case, get a needle and
172 scratch the pins apart again. This happened to me fairly
173 regularly; other than that, the hardware is rock-solid.
175 The connections of the boot key are:
177 =========== ===========
179 =========== ===========
186 =========== ===========
188 Be sure to mark the "1" sides on all your connectors, and to
189 attach labels to each cable explaining what they do and what
190 signals they are made for.
192 For parport-i2c, please construct an I2C interface as documented
193 in the Linux kernel. The 0cpm Firmerware contains a programming
194 utility under ``bin/i2cp``. I've found that the TTL logic of
195 the 5V-based parallel port on my PC naturally yielded levels
196 that would work for I2C at 3V3. Be careful though, you may
197 end up blowing more than your mind away.
199 .. figure:: pix/bootfloppy-i2c-parport_pc.jpg
201 The entire parport-i2c interface fits inside a D-BUS plug.
204 Getting started with development
205 ================================
207 Time to get all soft now.
210 Setting up your development environment
211 ---------------------------------------
213 Get the toolchain from TI. They make it available at no cost.
214 Unfortunately their license is a bit tight about distributing the
215 toolchain alongside software that is not purely intended for their
216 chips. I intend to wiggle this a bit and get a special arrangement
217 for the 0cpm Firmerware in light of the GPLv3 requirements.
219 The toolchain can be found on ti.com, but may take some searching;
220 its location is not constant and they are more eager in showing
221 their more complete (and much more pricy) Code Composer Studio.
222 But TI is motivated to support open source projects, and will even
223 help you out if you cannot find it. (Or I could, of course.)
225 I installed to toolchain into ``/opt/tic55x-ti/`` and this may
226 actually be reflected in these early build environments. Other
227 than this, you would need the usual suspects -- notably, ``make``.
230 Checking out the 0cpm Firmerware
231 --------------------------------
233 I hope to have all that is required for an outsider build available
234 in GIT; the only exception may be a few booting scripts that setup
235 the BSS and STATIC areas, and a number of registers that need to be
236 setup early in the hardware.
238 Sorry I haven't taken the time to check outsider builds yet, that
239 is one reason why this is pre-alphe software. If you end up in
240 unsolveable trouble, contact me and I can probably help you out.
242 Note that the reason that these parts are missing is because I don't
243 want to break anyone's copyrights, which publication in GIT would
244 do. I can proably talk you through finding it in your local setup though.
247 Anyhow, this is the GIT repository for the 0cpm Firmerware:
249 git://git.0cpm.org/firmerware/
251 You should be able to clone it and continue from there.
252 Once again, this is pre-alpha software, I aim to checkin only
253 compiling versions but in this phase I suppose I'm allowed to
254 be human. Please don't expand on my mistakes by checking in
255 your non-compiling versions into my repository.
258 Configuring the 0cpm Firmerware
259 -------------------------------
261 In the root directory of the 0cpm Firmerware, type::
265 You will recognise the same build system as used by Linux
266 and BusyBox, which I've shamelessly, ehm... shared.
268 Make the following setup:
270 * Configuration meta: Setup your toolchain prefix, and use
271 the 6bed4 address announced on http://devel.0cpm.org/6bed4/
272 and development build options shown to you.
273 or --at some point hopefully-- in the RFC.
274 * Hardware manufacturer: Grandstream
275 * Phone models: Budgetone 200/201
276 * Hardware platform: tic55x
277 * Under Firmware Functions, start with the first primary
278 function and work your way up to the SIP phone over IPv6.
279 Read the respective Help page to see what it is doing.
281 Note that various functions claimed in the configuration
282 are not implemented yet; pre-alpha, remember?
285 Building the 0cpm Firmerware
286 ----------------------------
288 Couldn't be simpler::
292 The resulting firmware is found in ``bin/firmerware.bin``.
295 Testing the 0cpm Firmerware on the phone
296 ----------------------------------------
298 Assuming you've soldered the EEPROM stack that I suggested,
299 you could use the ``i2cp`` utility. You may need to build
306 Then you can upload it as follows, but possibly with a
309 i2cp bin/firmerware.bin /dev/i2c-2
311 Now reboot the phone with the boot key inserted. The
312 bootloader will recognise your wish to bootstrap the
313 DSP from the I2C EEPROMs. Permit a few seconds for the
314 I2C download and DSP setup. Still, it's a lot faster
315 than the original firmware, mostly because it is smaller.
317 You can now conduct the tests described for the main
318 function that you selected.
322 Observing the phone's console
323 -----------------------------
325 Go ahead and stare at the display.
327 No, seriously, the phone can keep a log, although not in the
328 simplest test programs and otherwise as a configurable option.
330 The logs are accessed over LLC2_. You will need the tool
331 ``llcio`` contained in by hexio_ package. You may find more
332 utilities in this package useful when working with hardware;
333 for example, if you need a binary variation of ``minicom``.
337 .. _hexio : http://rick.vanrein.org/linux/hexio/
341 Download the Flash memory to your PC
342 ------------------------------------
344 When built with a bootloader main function, it is possible
345 to extract the entire contents of flash from the phone.
346 This is done over LLC1_, using an adapted TFTP utility
347 described under that link.
352 Making changes to the 0cpm Firmerware
353 =====================================
355 You are going to accept the 0cpm Firmerware without
356 a further thought, right? No bright ideas or wish
357 to innovate and extend?
359 Oh, so you *do* have ideas... well then... read on!
362 Legal hoops to jump through
363 ---------------------------
365 I welcome patches with whole my heart ``;-)`` but must
366 tell you right away: the TI compiler license is a bit
367 silly; it can only be distributed alongside software
368 that is strictly targeted for their chips. This means
369 that distributing the 0cpm Firmerware is either a breach
370 of their agreement, or GPLv3. As the code originator,
371 only I am not bound by the GPLv3 and can hand out the
372 code with a reference to the TI website for the tools.
374 I am asking all submitters to agree that I continue to
375 do this. In other words, they would not be providing
376 their updates under the GPL but under a more liberal
377 agreement. This is what I need to keep the code
378 generally available. I am sorry about this loophole
379 and will ask TI for more freedom as soon as the firmware
380 is stable, and something that TI would be proud of supporting.
382 If TI wouldn't want to bend, we could always move over to
383 opener architectures, like Blackfin. I want to use the
384 GPLv3 so there is no risk of manufacutrers legally
385 splitting off a closed fork. To be honest, at the time
386 this project started I was already quite happy to have
387 an initial platform to get the work going. Already now,
388 the firmware is much more solid and would probably be
392 Submissions of changes
393 ----------------------
395 For now, email should do fine. I'll scale up to
396 automatic things when I have to. Perhaps you could
397 publish your work in GIT and tell me about it.
400 Porting to other hardware
401 -------------------------
403 If you want to port to other infrastructure you should really
404 read the porting guide, contained in the ``doc`` directory of the
408 Manufacturing phones for the 0cpm Firmerware
409 --------------------------------------------
411 Please read the hardware design manual, contained in the ``doc``
412 directory of the 0cpm Firmerware.
415 Chores waiting for you to jump at them
416 --------------------------------------
418 There are a couple of chores that give me the feeling
419 that this project is growing over my head. Perhaps you
420 could help out with those:
422 * Personally, I've tried for months (on and off) to get
423 the codec chip TLV320AIC20K working. I have not given
424 up hope, but am wondering why I cannot get it to work.
425 Your input on that may be useful.
427 * The flash contains firmware that can be upgraded, but
428 the updates for code portions are somehow signed. It
429 would be tremendously useful if someone sent me the
430 algorithm. I would be happy to accept an anonymous
431 donation of such an algorithm from a determined code
434 * Various GXP models should be supported. So, rather than
435 purchasing the GXP1200, you could consider getting another
436 model, and adapting the firmware to match it.
438 * There are exciting extension possibilities; Grandstream
439 has a GXV series involving a camera, colour display and
440 sometimes even a touch screen. It would be lovely if
441 someone found the time to look into those. They use
442 a tic6x architecture AFAIK.
444 * DECT is not as open as Ethernet, so I may need help from
445 others in developing that area. Also, the model of DECT
446 is somewhat different -- a base station runs as a
447 multi-headed dragon, servicing multiple users who each
448 hold their own terminal.
450 * ATAs are useful devices to those who are just getting
451 started with SIP, and also as intermediaries for textphones
452 in use by the deaf. Supporting the chips used in those
453 should be a treat in tone recognition and sound handling.
454 I mean it, the chips used look very interesting.
456 * In a second phase of ATA support, a very special piece of
457 hardware to support could be Rowetel's `$10 ATA`_,
458 designed as an extension to OpenWRT. Rowetel is doing
459 great work by supporting telecommunications for development
460 countries; this is a vital piece of technology to enable
461 people to plan and arrange things, and helps to set them
462 free. You may also find an extremely low bitrate codec
463 named Codec2 as part of the 0cpm Firmerware; it is there
464 to enable these developing countries to connect to the
465 rest of the world at the low bitrates that they are
466 dependent upon over there.
468 * The new GXP series has graphical displays that need
469 reverse engineering; I've done some work on it but
472 .. _`$10 ATA` : http://www.rowetel.com/blog/?p=1987