deliver an icon for the Debian menu system
[fw/altos] / ao-tools / ao-dbg / ao-dbg.1
1 .\"
2 .\" Copyright © 2009 Keith Packard <keithp@keithp.com>
3 .\"
4 .\" This program is free software; you can redistribute it and/or modify
5 .\" it under the terms of the GNU General Public License as published by
6 .\" the Free Software Foundation; either version 2 of the License, or
7 .\" (at your option) any later version.
8 .\"
9 .\" This program is distributed in the hope that it will be useful, but
10 .\" WITHOUT ANY WARRANTY; without even the implied warranty of
11 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 .\" General Public License for more details.
13 .\"
14 .\" You should have received a copy of the GNU General Public License along
15 .\" with this program; if not, write to the Free Software Foundation, Inc.,
16 .\" 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 .\"
18 .\"
19 .TH AO-DBG 1 "ao-dbg" ""
20 .SH NAME
21 ao-dbg \- hex debugger for cc1111 processors
22 .SH SYNOPSIS
23 .B "ao-dbg"
24 [\-t \fIcpu-type\fP]
25 [\-X \fIfrequency\fP]
26 [\-c]
27 [\-r \fIlisten-port\fP]
28 [\-Z \fIlisten-port\fP]
29 [\-s]
30 [\-S]
31 [\-p \fIprompt\fP]
32 [\-V]
33 [\-v]
34 [\-H]
35 [\-h]
36 [\-m]
37 [\-T \fItty-device\fP]
38 .SH DESCRIPTION
39 .I ao-dbg
40 connects to a cc1111 processor through either a suitable cc1111 board
41 or a cp2103 usb to serial converter board, using the GPIO pins
42 available on that chip. It provides an interface compatible with the
43 8051 emulator from sdcc called s51, but communicating with the real
44 chip instead of an emulation. Using a modified version of the SDCC
45 debugger (sdcdb), you can control program execution on the target
46 machine at source-level.
47
48 .SH OPTIONS
49 The command line options are designed to be compatible with the 8051
50 emulator so that it can be used with sdcdb. As such, they're all one letter
51 long.
52 .IP "\-t \fIcpu-type\fP"
53 The 8051 emulator can operate as one of several different chips. Oddly, the
54 real hardware cannot, so this option is ignored.
55 .IP "\-X \fIfrequency\fP"
56 Similarly, the emulator can pretend to run at an arbitrary frequency
57 which the real hardware cannot do. Ignored.
58 .IP "\-c"
59 .IP "\-s"
60 .IP "\-S"
61 .IP "\-v"
62 .IP "\-V"
63 All ignored.
64 .IP "\-r \fIlisten-port\fP, -Z \fIlisten-port\fP"
65 The emulator and sdcdb communicate through a network socket. This option
66 switches the debugger from communicating through stdin/stdout to listening
67 on a specific network port instead. Once a connection is made, the debugger
68 continues on, using that network port for command input and output. The
69 debugger uses port 9756, and attempts to connect before launching ao-dbg, so if
70 ao-dbg is listening on this port before sdcdb is started, sdcdb will end up
71 talking to the existing ao-dbg instance. That's often useful for debugging ao-dbg
72 itself.
73 .IP "\-p \fIprompt\fP"
74 This sets the command prompt to the specified string.
75 .IP "\-P"
76 This sets the command prompt to a single NUL character. This is for use by
77 sdcdb.
78 .IP "\-h"
79 This should print a usage message, but does nothing useful currently.
80 .IP "\-m"
81 This option is not present in the original 8051 emulator, and causes ao-dbg to
82 dump all commands and replies that are received from and sent to sdcdb.
83 .IP "\-T"
84 This selects which tty device the debugger uses to communicate with
85 the target device. The special name 'BITBANG' directs ao-dbg to use
86 the cp2103 connection, otherwise this should be a usb serial port
87 connected to a suitable cc1111 debug node.
88 .SH COMMANDS
89 Once started, ao-dbg connects to the cc1111 and then reads and
90 executes commands, either from stdin, or the nework connection to
91 sdcdb.
92 .PP
93 Unlike the command line, ao-dbg contains built-in help for each of these
94 commands, via the 'help' command. Most of the commands are available in a
95 long form and a single character short form. Below, the short form follows
96 the long form after a comma.
97 .IP "help, ? {command}"
98 Without arguments, prints a list of available commands. With an argument
99 prints more detail about the specific command
100 .IP "quit, q"
101 Terminates the application, without changing the state of the target
102 processor.
103 .IP "di [start] [end]"
104 Dumps imem (256 bytes of "internal" memory) from start to end (inclusive).
105 .IP "ds [start] [end]"
106 Dumps sprs from start to end (inclusive). Note that while most sprs are
107 visible in the global address space, some are not, so use this command
108 instead of "dx" to read them.
109 .IP "dx [start] [end]"
110 Dump external (global) memory from start to end (inclusive).
111 .IP "set, t <prefix> [start] {data ...}"
112 Store to the memory space specified by prefix where prefix is one of "xram",
113 "rom", "iram", or "sfr". Store bytes starting at start.
114 .IP "dump, d <prefix> [start] [end]"
115 Dump from the memory space specified by prefix, where prefix is one of
116 "xram", "rom", "iram" or "sfr". Dumps from start to end (inclusive).
117 .IP "file [filename]"
118 Specifies an intel-format hex file (ihx) that contains the contents of the
119 rom area loaded into the cc1111. This is used to respond to requests to dump
120 rom memory contents without getting them from the cc1111 (which is slow).
121 .IP "pc, p {address}"
122 If the address argument is given, this sets the program counter to the
123 specified value. Otherwise, the current program counter value is displayed.
124 .IP "break, b [address]"
125 Sets a breakpoint at the specified address. This uses the built-in hardware
126 breakpoint support in the cc1111. As a result, it supports no more than four
127 breakpoints at once. You must therefore use a modified version of sdcdb which
128 changes how program execution is controlled to work within this limit.
129 .IP "clear, c [address]"
130 Clear a breakpoint from the specified address.
131 .IP "run, r, go, g {start} {stop}"
132 Resumes execution of the program. If the start argument is present, then it
133 begins at that address, otherwise it continues running at the current pc. If
134 a stop argument is present, then a temporary breakpoint is set at that
135 address. This temporary breakpoint will be removed when execution hits it.
136 .IP "next, n"
137 Step one instruction. In the original s51 program this would ignore
138 subroutines, but as sdcdb doesn't require this functionality, it's not
139 available here.
140 .IP "step, s"
141 Step one instruction.
142 .IP "load, l [filename]"
143 This is not implemented, but it is supposed to load a hex file into flash.
144 Use the ccload program instead.
145 .IP "halt, h"
146 Halt the processor. This is the only command which can be sent while the
147 program is running. It is ignored at other times.
148 .IP "reset, res"
149 Reset the processor. This pulls the reset pin low and re-enables debug mode.
150 Check the cc1111 documentation to see precisely what this does.
151 .IP "status"
152 This dumps the cc1111 debug status register.
153 .IP "info, i breakpoints, b"
154 List the current breakpoints.
155 .IP "info, i help, ?"
156 List the things you can get info on.
157 .IP "stop"
158 This doesn't do anything and is present only to retain compatibility with
159 the original 8051 emulator.
160 .SH "BOARD BRINGUP DEBUGGING"
161 .PP
162 While the original purpose for this program was to connect the source
163 debugger with the hardware, it can also be used as a low-level hex debugger
164 all on its own. In particular, all of the cc1111 peripherals can be
165 manipulated directly from the ao-dbg command line.
166 .IP "Starting ao-dbg"
167 First ensure that the target cc1111 device and intermediate cp2103 or
168 cc111 board are all hooked up correctly.
169 .IP
170 $ ao-dbg
171 .br
172 Welcome to the non-simulated processor
173 .br
174 > status
175 .br
176         CPU halted
177 .br
178         Halted by debug command
179 .br
180 >
181 .IP "Turning on LEDs"
182 Two of the cc1111 GPIO pins, P1_0 and P1_1 are capable of driving external
183 LEDs. To control these, set the Port 1 direction bits to make these output
184 pins and then change the Port 1 data to set them high or low:
185 .IP
186 > set sfr 0xfe 0x02     # set P1DIR to 0x2
187 .br
188 > set sfr 0x90 0x02     # set P1_1 to high
189 .br
190 > set sfr 0x90 0x00     # set P1_1 to low
191 .IP "Reading the A/D converters"
192 The six A/D converter inputs can each be connected to any of the P0 pins,
193 ground, the A/D voltage refernece, an internal temperature sensor or VDD/3.
194 To read one of these values, select an A/D converter to use then start the
195 conversion process. The cc1111 manual has the table for selecting the input
196 on page 144.
197 .IP
198 To configure one of the P0 pins for use by the A/D unit, we program the
199 ADCCFG register, setting the bits in that which match the pins desired:
200 .IP
201 > set sfr 0xf2 0x3f     # enable all 6 A/D inputs
202 .IP
203 To trigger a single conversion, we ask the A/D unit to perform an 'extra'
204 conversion, which means to do a single conversion not a whole sequence of
205 conversions. This is controlled by the ADCCON3 register at 0xB6:
206 .IP
207 > set sfr 0xb6 0xb2     # sample P0_2 using 12 bits of precision
208 .br
209 > ds 0xba 0xbb          # dump the ADC data low and high regs
210 .br
211 > set sfr 0xb6 0xbe     # sample internal temperature sensor
212 .br
213 > ds 0xba 0xbb          # dump the ADC data low and high regs
214 .SH "SEE ALSO"
215 sdcdb(1), ccload(1)
216 .SH AUTHOR
217 Keith Packard