Osmocon » History » Version 28
laforge, 02/21/2016 08:11 AM
1 | 27 | steve-m | {{>toc}} |
---|---|---|---|
2 | 1 | laforge | |
3 | 28 | laforge | @osmocon@ is a console tool for interfacing our baseband firmwar on the phone with applications in the host PC. |
4 | 1 | laforge | |
5 | 28 | laforge | It is also used to download a firmware or bootloader into the phone over the serial line, which is currently implemented for the [[MotorolaC123|CompalE88 (C118C120C121C123)]] the [[MotorolaC155|CompalE99 (C155)]]. |
6 | 27 | steve-m | |
7 | |||
8 | Supported Bootloaders are currently the [[CompalRamloader]] and the [[HardwareCalypsoRomloader]]. |
||
9 | |||
10 | 1 | laforge | After uploading a firmware, it turns into an HDLC mulitplexer/demultiplexer, allowing for multichannel communication with the device. |
11 | |||
12 | The phones console is on one such channel and will be redirected to the terminal (stdout) on which osmocom runs. |
||
13 | |||
14 | 8 | laforge | Several other HDLC channels are accessible by means of the following unix domain sockets: |
15 | 23 | laforge | * /tmp/osmocom_l2 for the [[L1A_L23_Interface]] as used by [[mobile]], [[ccch_scan]] and other host programs |
16 | 27 | steve-m | * /tmp/osmocon_loader for the [[Bootloader]] |
17 | |||
18 | 28 | laforge | {{graphviz_link() |
19 | 14 | laforge | digraph G { |
20 | 1 | laforge | graph [rankdir = LR]; |
21 | 28 | laforge | Phone -> SerialPort [ label = "RS232" dir=both ]; |
22 | SerialPort -> osmocon [ label = "/dev/ttyUSB*" dir=both ]; |
||
23 | 1 | laforge | layer23 -> osmocon [label = "unix socket" dir=both ]; |
24 | osmoload -> osmocon [label = "unix socket" dir=both ]; |
||
25 | firmware -> osmocon [label = "file read" ]; |
||
26 | osmocon -> terminal [label = "stdout" ]; |
||
27 | 19 | laforge | osmocon [ shape = doublecircle ]; |
28 | 14 | laforge | layer23 [ shape = circle label = "mobile"]; |
29 | 1 | laforge | osmoload [ shape = circle]; |
30 | 9 | laforge | { rank = same; terminal layer23 osmoload firmware } |
31 | 27 | steve-m | } |
32 | 28 | laforge | }} |
33 | 20 | laforge | |
34 | 27 | steve-m | h2. General Usage |
35 | |||
36 | |||
37 | * *Connect your phone* UART to a serial port of your PC, using a [[HardwareSerialCable]] (3.3V RS232 on 2.5mm headphone jack) |
||
38 | * *Choose firmware* you have to load, depending on a host program you want to run (see [[Applications]]) |
||
39 | * *Load firmware* to the phone, running osmocon like below. Fill in phone type and firmware name with your values. See [[HardwarePhones]] if you need to look up the phone type. |
||
40 | <pre> |
||
41 | 9 | laforge | $ ./osmocon -p /dev/ttyUSB0 -m c123xor ../../target/firmware/board/PHONE_TYPE/FIRMWARE.compalram.bin |
42 | 27 | steve-m | </code></pre> |
43 | * Make sure your phone is off. *Briefly press the power-on button* of your phone (short push, not like a regular phone boot!). Avoid charging the phone while using osmocon, this can inhibit the loader. |
||
44 | * Observe output resembling the following |
||
45 | <pre> |
||
46 | 13 | laforge | got 2 bytes from modem, data looks like: 2f c8 |
47 | 1 | laforge | got 5 bytes from modem, data looks like: 1b f6 02 00 41 |
48 | got 1 bytes from modem, data looks like: 01 |
||
49 | got 1 bytes from modem, data looks like: 40 |
||
50 | Received PROMPT1 from phone, responding with CMD |
||
51 | read_file(../../target/firmware/board/compal_e88/loader.compalram.bin): file_size=13404, hdr_len=4, dnload_len=13411 |
||
52 | got 1 bytes from modem, data looks like: 1b |
||
53 | got 1 bytes from modem, data looks like: f6 |
||
54 | got 1 bytes from modem, data looks like: 02 |
||
55 | 9 | laforge | got 1 bytes from modem, data looks like: 00 |
56 | got 1 bytes from modem, data looks like: 41 |
||
57 | got 1 bytes from modem, data looks like: 02 |
||
58 | got 1 bytes from modem, data looks like: 43 |
||
59 | Received PROMPT2 from phone, starting download |
||
60 | handle_write(): 1023 bytes (1023/13411) |
||
61 | handle_write(): 768 bytes (1791/13411) |
||
62 | handle_write(): 768 bytes (2559/13411) |
||
63 | handle_write(): 768 bytes (3327/13411) |
||
64 | handle_write(): 768 bytes (4095/13411) |
||
65 | handle_write(): 768 bytes (4863/13411) |
||
66 | handle_write(): 768 bytes (5631/13411) |
||
67 | handle_write(): 768 bytes (6399/13411) |
||
68 | handle_write(): 768 bytes (7167/13411) |
||
69 | handle_write(): 768 bytes (7935/13411) |
||
70 | 1 | laforge | handle_write(): 768 bytes (8703/13411) |
71 | handle_write(): 768 bytes (9471/13411) |
||
72 | handle_write(): 768 bytes (10239/13411) |
||
73 | handle_write(): 768 bytes (11007/13411) |
||
74 | handle_write(): 768 bytes (11775/13411) |
||
75 | handle_write(): 768 bytes (12543/13411) |
||
76 | handle_write(): 768 bytes (13311/13411) |
||
77 | handle_write(): 100 bytes (13411/13411) |
||
78 | handle_write(): finished |
||
79 | got 1 bytes from modem, data looks like: 1b |
||
80 | got 1 bytes from modem, data looks like: f6 |
||
81 | got 1 bytes from modem, data looks like: 02 |
||
82 | got 1 bytes from modem, data looks like: 00 |
||
83 | got 1 bytes from modem, data looks like: 41 |
||
84 | got 1 bytes from modem, data looks like: 03 |
||
85 | 23 | laforge | got 1 bytes from modem, data looks like: 42 |
86 | 1 | laforge | Received DOWNLOAD ACK from phone, your code is running now! |
87 | |||
88 | |||
89 | OSMOCOM Calypso loader (revision f45c5ee-modified) |
||
90 | ====================================================================== |
||
91 | Running on compal_e88 in environment ramload |
||
92 | |||
93 | 27 | steve-m | </code></pre> |
94 | * You can now interact with the phone through application programs like [[mobile]], [[ccch_scan]], [[osmoload]], and others, depending on the firmware you loaded. |
||
95 | 1 | laforge | |
96 | 27 | steve-m | |
97 | h2. Command Line Parameters |
||
98 | |||
99 | 1 | laforge | <pre> |
100 | 27 | steve-m | Usage: ./osmocon [ -v | -h ] [ -d [t][r] ] [ -p /dev/ttyXXXX ] |
101 | 1 | laforge | [ -s /tmp/osmocom_l2 ] |
102 | [ -l /tmp/osmocom_loader ] |
||
103 | [ -m {c123,c123xor,c140,c140xor,c155,romload,mtk} ] |
||
104 | [ -c /to-be-chainloaded-file.bin ] |
||
105 | [ -i beacon-interval (mS) ] |
||
106 | file.bin |
||
107 | </code></pre> |
||
108 | |||
109 | 27 | steve-m | |
110 | 28 | laforge | h3. @-v@ Version |
111 | 1 | laforge | |
112 | 27 | steve-m | Show the version of the program |
113 | |||
114 | 28 | laforge | h3. @-h@ Help |
115 | 1 | laforge | |
116 | 15 | laforge | Get a short help message |
117 | 1 | laforge | |
118 | 28 | laforge | h3. @-d [t][r]@ Debug flags |
119 | 1 | laforge | |
120 | 28 | laforge | Enable debug output of transmitted @t@ and/or received @r@ serial data |
121 | 1 | laforge | |
122 | 28 | laforge | h3. @-p /dev/ttyXXXX@ Serial Device |
123 | 27 | steve-m | |
124 | Specify the Serial Port to which your phone is connected, e.g. /dev/ttyUSB0 for the first USB-Serial converter in your system |
||
125 | |||
126 | 28 | laforge | h3. @-s /path/to/socket@ Path of L1CTL socket |
127 | 17 | laforge | |
128 | 27 | steve-m | Specify the file system path for the unix domain socket to be used for L1CTL |
129 | |||
130 | 28 | laforge | h3. @-l /path/to/socket@ Path to Loader socket |
131 | 27 | steve-m | |
132 | Specify the file system path for the unix domain socket to be used for interaction with [[osmoload]] |
||
133 | 15 | laforge | |
134 | 28 | laforge | h3. @-i time@ beacon interval, in milliseconds |
135 | 27 | steve-m | |
136 | Specify the beacon interval. On some devices default value should be adjusted in order for loading to work (for example Neo Freerunner works wit -i 13) |
||
137 | |||
138 | 28 | laforge | h3. @-m {c123,c123xor,c140,c140xor,c155,romload,mtk}@ Download protocol mode |
139 | 27 | steve-m | |
140 | Select the protocol to be used for interaction with the phone: |
||
141 | 28 | laforge | * @c123@ use the variant implemented by C118/C121/C123 |
142 | * @c123xor@ use the variant implemented by C118/C121/C123 including XOR checksum |
||
143 | * @c140@ use the variant implemented by C139/C140 |
||
144 | * @c140xor@ use the variant implemented by C139/C140 including XOR checksum |
||
145 | * @c155@ use the variant implemented by C155 |
||
146 | * @romload@ use the variant implemented by the Ti Calypso rom-loader (aka fluid) |
||
147 | * @mtk@ use the protocol used by Mediatek DBB |
||
148 | 27 | steve-m | |
149 | h2. Known Problems |
||
150 | |||
151 | 28 | laforge | In some situations (like, apparently, using FTDI serial cables), you might need the @-m c123@ mode for your [[MotorolaC123]] instead of the normal @-m c123xor@. |