Debian Codegraph @

doc/avarice.1

raw
1 .ig
2 Copyright (C) 2001 Scott Finneran
3 Copyright (C) 2003 Intel Corporation
4 Copyright (C) 2003, 2004 Theodore A. Roth
5 Copyright (C) 2005 - 2018 Joerg Wunsch
6
7 Permission is granted to make and distribute verbatim copies of this
8 manual provided the copyright notice and this permission notice are
9 preserved on all copies.
10
11 Permission is granted to copy and distribute modified versions of this
12 manual under the conditions for verbatim copying, provided that the
13 entire resulting derived work is distributed under the terms of a
14 permission notice identical to this one.
15
16 Permission is granted to copy and distribute translations of this
17 manual into another language, under the above conditions for modified
18 versions, except that this permission notice may be included in
19 translations approved by the Free Software Foundation instead of in
20 the original English.
21
22 $Id: avarice.1 380 2020-08-31 21:01:26Z joerg_wunsch $
23
24 ..
25 .TH avarice 1 "October 15, 2018"
26 .SH NAME
27 avarice \- Provides an interface from avr-gdb to Atmel's AVR in-circuit debugging tools
28 .SH SYNOPSIS
29 .B avarice
30 [\fIOPTIONS\fR]... [[\fIHOST_NAME\fR]:\fIPORT\fR]
31 .SH DESCRIPTION
32 .PP
33 AVaRICE runs on a POSIX machine and connects to gdb via a TCP socket and
34 communicates via gdb's "serial debug protocol". This protocol allows gdb to
35 send commands like "set/remove breakpoint" and "read/write memory".
36 .PP
37 AVaRICE translates these commands into the Atmel protocol used to control the
38 AVR JTAG ICE. Connection to the AVR JTAG ICE is via a serial port on the POSIX
39 machine.
40 .PP
41 Because the GDB <---> AVaRICE connection is via a TCP socket, the two programs
42 do not need to run on the same machine. In an office environment, this allows
43 a developer to debug a target in the lab from the comfort of their cube (or
44 even better, their home!)
45 .HP 6
46 .B NOTE:
47 Even though you can run \fBavarice\fR and \fBavr\-gdb\fR on different systems,
48 it is not recommended because of the security risk involved. \fBavarice\fR was
49 not designed to be a secure server. There is no authentication performed
50 when a client connects to \fBavarice\fR when it is running in gdb server mode.
51 .SS Supported Devices
52 .B avarice
53 currently has support for the following devices:
54 .RS 4
55 at90can128
56 .br
57 at90can32 (\fBo\fP)
58 .br
59 at90can64 (\fBo\fP)
60 .br
61 at90pwm2 (\fBo\fP) (\fB+\fP)
62 .br
63 at90pwm216 (\fBo\fP) (\fB+\fP)
64 .br
65 at90pwm2b (\fBo\fP) (\fB+\fP)
66 .br
67 at90pwm3 (\fBo\fP) (\fB+\fP)
68 .br
69 at90pwm316 (\fBo\fP) (\fB+\fP)
70 .br
71 at90pwm3b (\fBo\fP) (\fB+\fP)
72 .br
73 at90usb1287 (\fBo\fP)
74 .br
75 at90usb162 (\fBo\fP) (\fB+\fP)
76 .br
77 at90usb646 (\fBo\fP)
78 .br
79 at90usb647 (\fBo\fP)
80 .br
81 atmega128
82 .br
83 atmega1280 (\fBo\fP)
84 .br
85 atmega1281 (\fBo\fP)
86 .br
87 atmega1284p (\fBo\fP)
88 .br
89 atmega128rfa1 (\fBo\fP)
90 .br
91 atmega16
92 .br
93 atmega162
94 .br
95 atmega164p (\fBo\fP)
96 .br
97 atmega165 (\fBo\fP)
98 .br
99 atmega165p (\fBo\fP)
100 .br
101 atmega168 (\fBo\fP) (\fB+\fP)
102 .br
103 atmega168p (\fBo\fP) (\fB+\fP)
104 .br
105 atmega169
106 .br
107 atmega16hva (\fBo\fP)
108 .br
109 atmega16m1 (\fBo\fP) (\fB+\fP)
110 .br
111 atmega2560 (\fBo\fP)
112 .br
113 atmega2561 (\fBo\fP)
114 .br
115 atmega32
116 .br
117 atmega323
118 .br
119 atmega324p (\fBo\fP)
120 .br
121 atmega325 (\fBo\fP)
122 .br
123 atmega3250 (\fBo\fP)
124 .br
125 atmega3250p (\fBo\fP)
126 .br
127 atmega325p (\fBo\fP)
128 .br
129 atmega328p (\fBo\fP) (\fB+\fP)
130 .br
131 atmega329 (\fBo\fP)
132 .br
133 atmega3290 (\fBo\fP)
134 .br
135 atmega3290p (\fBo\fP)
136 .br
137 atmega329p (\fBo\fP)
138 .br
139 atmega32c1 (\fBo\fP) (\fB+\fP)
140 .br
141 atmega32hvb (\fBo\fP) (\fB+\fP)
142 .br
143 atmega32m1 (\fBo\fP) (\fB+\fP)
144 .br
145 atmega32u4 (\fBo\fP)
146 .br
147 atmega406 (\fBo\fP)
148 .br
149 atmega48 (\fBo\fP) (\fB+\fP)
150 .br
151 atmega48p (\fBo\fP) (\fB+\fP)
152 .br
153 atmega64
154 .br
155 atmega640 (\fBo\fP)
156 .br
157 atmega644 (\fBo\fP)
158 .br
159 atmega644p (\fBo\fP)
160 .br
161 atmega645 (\fBo\fP)
162 .br
163 atmega6450 (\fBo\fP)
164 .br
165 atmega649 (\fBo\fP)
166 .br
167 atmega6490 (\fBo\fP)
168 .br
169 atmega64c1 (\fBo\fP) (\fB+\fP)
170 .br
171 atmega64m1 (\fBo\fP) (\fB+\fP)
172 .br
173 atmega88 (\fBo\fP) (\fB+\fP)
174 .br
175 atmega88p (\fBo\fP) (\fB+\fP)
176 .br
177 attiny13 (\fBo\fP) (\fB+\fP)
178 .br
179 attiny167 (\fBo\fP) (\fB+\fP)
180 .br
181 attiny2313 (\fBo\fP) (\fB+\fP)
182 .br
183 attiny24 (\fBo\fP) (\fB+\fP)
184 .br
185 attiny25 (\fBo\fP) (\fB+\fP)
186 .br
187 attiny261 (\fBo\fP) (\fB+\fP)
188 .br
189 attiny4313 (\fBo\fP) (\fB+\fP)
190 .br
191 attiny43u (\fBo\fP) (\fB+\fP)
192 .br
193 attiny44 (\fBo\fP) (\fB+\fP)
194 .br
195 attiny45 (\fBo\fP) (\fB+\fP)
196 .br
197 attiny461 (\fBo\fP) (\fB+\fP)
198 .br
199 attiny48 (\fBo\fP) (\fB+\fP)
200 .br
201 attiny84 (\fBo\fP) (\fB+\fP)
202 .br
203 attiny85 (\fBo\fP) (\fB+\fP)
204 .br
205 attiny861 (\fBo\fP) (\fB+\fP)
206 .br
207 attiny88 (\fBo\fP) (\fB+\fP)
208 .br
209 atxmega128a1 (\fBo\fP) (\fB*\fP)
210 .br
211 atxmega128a1revd (\fBo\fP) (\fB*\fP)
212 .br
213 atxmega128a3 (\fBo\fP) (\fB*\fP)
214 .br
215 atxmega192a3 (\fBo\fP) (\fB*\fP)
216 .br
217 atxmega256a3 (\fBo\fP) (\fB*\fP)
218 .br
219 atxmega32a4 (\fBo\fP) (\fB*\fP)
220 .br
221 atxmega16d4 (\fBo\fP) (\fB*\fP)
222 .br
223 atxmega128b1 (\fBo\fP) (\fB*\fP)
224 .br
225 atxmega128b3 (\fBo\fP) (\fB*\fP)
226 .br
227 atxmega64b1 (\fBo\fP) (\fB*\fP)
228 .br
229 atxmega64b3 (\fBo\fP) (\fB*\fP)
230 .RE
231 .PP
232 \fBo\fP \- Not supported by JTAG ICE mkI
233 .br
234 \fB*\fP \- Xmega device, requires firmware version of at least 7.x
235 (as shipped with AVR Studio 5)
236 .br
237 \fB+\fP \- debugWire, see below
238 .SS Supported File Formats
239 .B avarice
240 uses libbfd for reading input files. As such, it can handle any file format
241 that libbfd knowns about. This includes the Intel Hex, Motorola SRecord and
242 ELF formats, among others. If you tell \fBavarice\fR to read an ELF file, it
243 will automatically handle programming all of the sections contained in the
244 file (e.g. flash, eeprom, etc.).
245 .SH OPTIONS
246 .TP
247 .BR \-h ,\ \-\-help
248 Print this message.
249 .TP
250 .BR \-1 ,\ \-\-mkI
251 Connect to original JTAG ICE (default).
252 This is sometimes also called "mkI" to distinguish it from the more recent
253 versions.
254 Some simple clones are also around talking this protocol version.
255 .TP
256 .BR \-2 ,\ \-\-mkII
257 Connect to JTAG ICE mkII.
258 .TP
259 .BR \-3 ,\ \-\-jtag3
260 Connect to JTAGICE3 running firmware 2.x.
261 .TP
262 .BR \-4 ,\ \-\-edbg
263 Connect to an AtmelICE, or JTAGICE3 running firmware 3+, or embedded debugger (EDBG).
264 Requires that \fBavarice\fR has been compiled with libhidapi support.
265 .TP
266 .BR \-B ,\ \-\-jtag-bitrate \ <rate>
267 Set the bitrate that the JTAG box communicates with the AVR target device.
268 This must be less than 1/4 of the frequency of the target. Valid values are
269 1 MHz, 500 kHz, 250 kHz or 125 kHz for the JTAG ICE mkI,
270 anything between 22 kHz through approximately 6400 kHz for the
271 JTAG ICE mkII. (default: 250 kHz)
272 .TP
273 .BR \-C ,\ \-\-capture
274 Capture running program.
275 .br
276 Note: debugging must have been enabled prior to starting the program. (e.g.,
277 by running avarice earlier)
278 .TP
279 .BR \-c ,\ \-\-daisy-chain \ <ub,ua,bb,ba>
280 Setup JTAG daisy-chain information.
281 .br
282 Four comma-separated parameters need to be provided, corresponding to
283 \fIunits before\fP, \fIunits after\fP, \fIbits before\fP, and
284 \fIbits after\fP.
285 .TP
286 .BR \-D ,\ \-\-detach
287 Detach once synced with JTAG ICE
288 .TP
289 .BR \-d ,\ \-\-debug
290 Enable printing of debug information.
291 .TP
292 .BR \-e ,\ \-\-erase
293 Erase target.
294 Not possible in debugWire mode.
295 .TP
296 .BR \-E ,\ \-\-event\ <eventlist>
297 List of events that do not interrupt.
298 JTAG ICE mkII and AVR Dragon only.
299 Default is "none,run,target_power_on,target_sleep,target_wakeup"
300 .TP
301 .BR \-f ,\ \-\-file \ <filename>
302 Specify a file for use with the \-\-program and \-\-verify options. If \-\-file is
303 passed and neither \-\-program or \-\-verify are given then \-\-program is implied.
304 .BR
305 .B NOTE:
306 deprecated feature, must be enabled using the \-\-enable-target-programming
307 configuration option.
308 .TP
309 .BR \-g ,\ \-\-dragon
310 Connect to an AVR Dragon.
311 This option implies the \fB-2\fP option.
312 .TP
313 .BR \-I ,\ \-\-ignore-intr
314 Automatically step over interrupts.
315 .TP
316 .BR \-j ,\ \-\-jtag \ <devname>
317 Serial port attached to JTAG box (default: /dev/avrjtag). If the JTAG_DEV environmental
318 variable is set, avarice will use that as the default instead.
319 .br
320 If \fBavarice\fR has been configured with libusb support, the JTAG ICE
321 mkII can be connected through USB.
322 In that case, the string \fIusb\fR is used as the name of the device.
323 If there are multiple JTAG ICE mkII devices connected to the system
324 through USB, this string may be followed by the (trailing part of the)
325 ICE's serial number, delimited from the \fIusb\fR by a colon.
326 .br
327 The AVR Dragon, JTAGICE3, AtmelICE, and EDBG can only be connected through USB, so this option
328 defaults to "usb" in that case.
329 .TP
330 .BR \-k ,\ \-\-known-devices
331 Print a list of known devices.
332 .TP
333 .BR \-L ,\ \-\-write-lockbits \ <ll>
334 Write lock bits. The lock byte data must be given in two digit hexidecimal
335 format with zero padding if needed.
336 .TP
337 .BR \-l ,\ \-\-read-lockbits
338 Read the lock bits from the target. The individual bits are also displayed
339 with names.
340 .TP
341 .BR \-P ,\ \-\-part \ <name>
342 Target device name (e.g. atmega16).
343 Normally, \fBavarice\fR autodetects the device via JTAG or debugWIRE.
344 If this option is provided, it overrides the result from the
345 autodetection.
346 .TP
347 .BR \-p ,\ \-\-program
348 Program the target. Binary filename must be specified with \-\-file option.
349 .BR
350 .B NOTE:
351 deprecated feature, must be enabled using the \-\-enable-target-programming
352 configuration option.
353 .TP
354 .BR \-R ,\ \-\-reset-srst
355 Apply nSRST signal (external reset) when connecting.
356 This can override applications that set the JTD bit.
357 .TP
358 .BR \-r ,\ \-\-read-fuses
359 Read fuses bytes.
360 .TP
361 .BR \-V ,\ \-\-version
362 Print version information.
363 .TP
364 .BR \-v ,\ \-\-verify
365 Verify program in device against file specified with \-\-file option.
366 .BR
367 .B NOTE:
368 deprecated feature, must be enabled using the \-\-enable-target-programming
369 configuration option.
370 .TP
371 .BR \-w ,\ \-\-debugwire
372 Connect to JTAG ICE mkII, JTAGICE3, or AVR Dragon, talking debugWire protocol to the target.
373 This option implies the \fB-2\fP option.
374 See the DEBUGWIRE section below.
375 .TP
376 .BR \-W ,\ \-\-write-fuses \ <eehhll>
377 Write fuses bytes. \fBee\fR is the extended fuse byte, \fBhh\fR is the high
378 fuse byte and \fBll\fR is the low fuse byte. The fuse byte data must be given
379 in two digit hexidecimal format with zero padding if needed. All three bytes
380 must currently be given.
381 .br
382 .B NOTE:
383 Current, if the target device doesn't have an extended fuse byte
384 (e.g. the atmega16), the you should set ee==ll when writing the fuse bytes.
385 .TP
386 .BR \-x ,\ \-\-xmega
387 The target device is an ATxmega part, using JTAG transport.
388 Since the ATxmega uses a different JTAG communication than other AVRs,
389 the normal device autodetection based on the JTAG ID does not work.
390 If the device has been explicitly selected through the \-P option,
391 it is not necessary to also specify the \-x option.
392 .TP
393 .BR \-X ,\ \-\-pdi
394 The target device is an ATxmega part, using PDI transport.
395 .PP
396 \fIHOST_NAME\fR defaults to 0.0.0.0 (listen on any interface) if not given.
397 .PP
398 :\fIPORT\fR is required to put avarice into gdb server mode.
399 .SH EXAMPLE USAGE
400 avarice \-\-erase \-\-program \-\-file test.bin \-\-jtag /dev/ttyS0 :4242
401 .PP
402 Program the file \fItest.bin\fR into the JTAG ICE (mkI) connected to
403 /dev/ttyS0 after erasing the device, then listen in GDB mode on the
404 local port 4242.
405 This functionality is deprecated, and no longer configured by default.
406 Use GDB's "load" command instead.
407 .PP
408 avarice \-\-jtag usb:1234 \-\-mkII :4242
409 .PP
410 Connect to the JTAG ICE mkII attached to USB which serial number ends
411 in \fI1234\fR, and listen in GDB mode on local port 4242.
412 .SH DEBUGGING WITH AVARICE
413 The JTAG ICE debugging environment has a few restrictions and changes:
414 .IP \(bu 4
415 No "soft" breakpoints, and only three hardware breakpoints. The break
416 command sets hardware breakpoints. The easiest way to deal with this
417 restriction is to enable and disable breakpoints as needed.
418 .IP \(bu
419 Two 1-byte hardware watchpoints (but each hardware watchpoint takes away
420 one hardware breakpoint). If you set a watchpoint on a variable which takes
421 more than one byte, execution will be abysmally slow. Instead it is better
422 to do the following:
423 .IP
424 .RS 6
425 watch *(char *)&myvariable
426 .RE
427 .IP
428 which watches the least significant byte of
429 .BR myvariable .
430 .IP \(bu
431 The Atmel AVR processors have a Harvard architecture (separate code and
432 data buses). To distinguish data address 0 from code address 0,
433 .B avr-gdb
434 adds 0x800000 to all data addresses. Bear this in mind when examining
435 printed pointers, or when passing absolute addresses to gdb commands.
436 .SH DEBUGWIRE
437 The \fIdebugWire\fP protocol is a proprietary protocol introduced
438 by Atmel to allow debugging small AVR controllers that don't offer
439 enough pins (and enough chip resources) to implement full JTAG.
440 The communication takes place over the \fI/RESET\fP pin which needs
441 to be turned into a debugWire connection pin by programming the
442 \fIDWEN\fP fuse (debugWire enable), using a normal programmer
443 connection (in-system programming, high-voltage programming).
444 Note that by enabling this fuse, the standard reset functionality
445 of that pin will be lost, so any in-system programming will cease
446 to work as it requires a functional \fI/RESET\fP pin.
447 Thus it should be made \fBabsolutely sure there is a way back\fP,
448 like a device (as the STK500, for example) that can handle
449 high-voltage programming of the AVR.
450 Currently, \fBavarice\fP offers no option to turn off the DWEN fuse.
451 However, \fBavrdude\fP offers the option to turn it off either
452 through high-voltage programming, or by using the JTAG ICE mkII to
453 first turn the target into an ISP-compatible mode, and then using
454 normal ISP commands to change the fuse settings.
455 .br
456 Note that the debugWire environment is further limited, compared to
457 JTAG.
458 It does not offer hardware breakpoints, so all breakpoints have to
459 be implemented as software breakpoints by rewriting flash pages
460 using \fIBREAK\fP instructions.
461 Some memory spaces (fuse and lock bits) are not accessible through
462 the debugWire protocol.
463 .SH SEE ALSO
464 .BR gdb (1),
465 .BR avrdude (1),
466 .BR avr\-gdb (1),
467 .BR insight (1),
468 .BR avr\-insight (1),
469 .BR ice\-gdb (1),
470 .BR ice\-insight (1)
471 .SH AUTHORS
472 Avarice (up to version 1.5) was originally written by Scott Finneran with help
473 from Peter Jansen. They did the work of figuring out the jtagice communication
474 protocol before Atmel released the spec (appnote AVR060).
475 .PP
476 David Gay made major improvements bringing avarice up to 2.0.
477 .PP
478 Joerg Wunsch reworked the code to abstract the JTAG ICE communication
479 from the remainder, and then extended the code to support the JTAG ICE
480 mkII protocol (see Atmel appnote AVR067), as well as the JTAGICE3 protocol.