avarice(1)
π¦ avarice β the girl who speaks fluent AVR
okay so bestie, welcome to avarice(1), general commands manual, and it's giving "I connect your gdb to Atmel's in-circuit debugger" and honestly? iconic. π
β¨ NAME β¨
avarice β provides an interface from avr-gdb to Atmel's AVR in-circuit debugging tools. yes that's the whole thing, that's the job, and she does it flawlessly. π«Ά
πΈ SYNOPSIS πΈ
avarice [OPTIONS]... [[HOST_NAME]:PORT]
π DESCRIPTION π
okay so here's the tea, bestie. AVaRICE runs on a POSIX machine, connects to gdb through a TCP socket, and they talk via gdb's "serial debug protocol". and what does that protocol do? it lets gdb send commands like "set/remove breakpoint" and "read/write memory". literally just vibes and breakpoints. β¨
then AVaRICE takes all those commands and translates them into the Atmel protocol used to control the AVR JTAG ICE. and how does she reach the AVR JTAG ICE? via a serial port on the POSIX machine. slay. π₯
and here's the fun part β because the GDB <---> AVaRICE connection is over a TCP socket, the two programs do not need to run on the same machine. in an office environment, this means you can debug a target in the lab from the comfort of your own cube (or even better, from home!). main character energy fr fr. π
NOTE: even though you can run avarice and avr-gdb on different systems, it is not recommended because of the security risk involved. avarice was not designed to be a secure server. there is no authentication performed when a client connects to avarice when it is running in gdb server mode. so like, don't be messy about it. π
π Supported Devices
avarice currently has support for the following devices:
at90can128
at90can32 (o)
at90can64 (o)
at90pwm2 (o) (+)
at90pwm216 (o) (+)
at90pwm2b (o) (+)
at90pwm3 (o) (+)
at90pwm316 (o) (+)
at90pwm3b (o) (+)
at90usb1287 (o)
at90usb162 (o) (+)
at90usb646 (o)
at90usb647 (o)
atmega128
atmega1280 (o)
atmega1281 (o)
atmega1284p (o)
atmega128rfa1 (o)
atmega16
atmega162
atmega164p (o)
atmega165 (o)
atmega165p (o)
atmega168 (o) (+)
atmega168p (o) (+)
atmega169
atmega16hva (o)
atmega16m1 (o) (+)
atmega2560 (o)
atmega2561 (o)
atmega32
atmega323
atmega324p (o)
atmega325 (o)
atmega3250 (o)
atmega3250p (o)
atmega325p (o)
atmega328p (o) (+)
atmega329 (o)
atmega3290 (o)
atmega3290p (o)
atmega329p (o)
atmega32c1 (o) (+)
atmega32hvb (o) (+)
atmega32m1 (o) (+)
atmega32u4 (o)
atmega406 (o)
atmega48 (o) (+)
atmega48p (o) (+)
atmega64
atmega640 (o)
atmega644 (o)
atmega644p (o)
atmega645 (o)
atmega6450 (o)
atmega649 (o)
atmega6490 (o)
atmega64c1 (o) (+)
atmega64m1 (o) (+)
atmega88 (o) (+)
atmega88p (o) (+)
attiny13 (o) (+)
attiny167 (o) (+)
attiny2313 (o) (+)
attiny24 (o) (+)
attiny25 (o) (+)
attiny261 (o) (+)
attiny4313 (o) (+)
attiny43u (o) (+)
attiny44 (o) (+)
attiny45 (o) (+)
attiny461 (o) (+)
attiny48 (o) (+)
attiny84 (o) (+)
attiny85 (o) (+)
attiny861 (o) (+)
attiny88 (o) (+)
atxmega128a1 (o) (*)
atxmega128a1revd (o) (*)
atxmega128a3 (o) (*)
atxmega192a3 (o) (*)
atxmega256a3 (o) (*)
atxmega32a4 (o) (*)
atxmega16d4 (o) (*)
atxmega128b1 (o) (*)
atxmega128b3 (o) (*)
atxmega64b1 (o) (*)
atxmega64b3 (o) (*)
and the little symbol decoder ring, because we love context:
oβ not supported by JTAG ICE mkI π*β Xmega device, requires firmware version of at least 7.x (as shipped with AVR Studio 5) β+β debugWire, see below π
π§ Supported File Formats
avarice uses libbfd for reading input files. as such, it can handle any file format that libbfd knows about. and that includes the Intel Hex, Motorola SRecord and ELF formats, among others. π
and the bestie behaviour: if you tell avarice to read an ELF file, it will automatically handle programming all of the sections contained in the file (e.g. flash, eeprom, etc.). she just handles it. no notes. π
π OPTIONS π
-h,--helpβ print this message. the "hi bestie what do you need" option.-1,--mkIβ connect to original JTAG ICE (default). this is sometimes also called"mkI"to distinguish it from the more recent versions. some simple clones are also around talking this protocol version. the OG, the blueprint. β¨-2,--mkIIβ connect to JTAG ICE mkII.-3,--jtag3β connect to JTAGICE3 running firmware 2.x.-4,--edbgβ connect to an AtmelICE, or JTAGICE3 running firmware 3+, or embedded debugger (EDBG). requires that avarice has been compiled with libhidapi support. no libhidapi, no entry. πͺ-B,--jtag-bitrate <rate>β set the bitrate that the JTAG box communicates with the AVR target device. this must be less than 1/4 of the frequency of the target. valid values are1 MHz,500 kHz,250 kHzor125 kHzfor the JTAG ICE mkI, and anything between22 kHzthrough approximately6400 kHzfor the JTAG ICE mkII. (default:250 kHz) ποΈ-C,--captureβ capture running program.
Note: debugging must have been enabled prior to starting the program. (e.g., by running avarice earlier)
-c,--daisy-chain <ub,ua,bb,ba>β setup JTAG daisy-chain information. four comma-separated parameters need to be provided, corresponding to units before, units after, bits before, and bits after. π¦-D,--detachβ detach once synced with JTAG ICE. she said "my work here is done" and left. π«Ά-d,--debugβ enable printing of debug information. for when you want to see the drama.-e,--eraseβ erase target. not possible in debugWire mode. β οΈ-E,--event <eventlist>β list of events that do not interrupt. JTAG ICE mkII and AVR Dragon only. default is"none,run,target_power_on,target_sleep,target_wakeup".-f,--file <filename>β specify a file for use with the--programand--verifyoptions. if--fileis passed and neither--programor--verifyare given then--programis implied. NOTE: deprecated feature, must be enabled using the--enable-target-programmingconfiguration option. π§-g,--dragonβ connect to an AVR Dragon. this option implies the-2option.-I,--ignore-intrβ automatically step over interrupts. she just walks past them like they're not even there. π-j,--jtag <devname>β serial port attached to JTAG box (default:/dev/avrjtag). if theJTAG_DEVenvironmental variable is set, avarice will use that as the default instead. if avarice has been configured with libusb support, the JTAG ICE mkII can be connected through USB. in that case, the stringusbis used as the name of the device. if there are multiple JTAG ICE mkII devices connected to the system through USB, this string may be followed by the (trailing part of the) ICE's serial number, delimited from theusbby a colon. the AVR Dragon, JTAGICE3, AtmelICE, and EDBG can only be connected through USB, so this option defaults to"usb"in that case. π-k,--known-devicesβ print a list of known devices. roll call, everyone say present. π-L,--write-lockbits <ll>β write lock bits. the lock byte data must be given in two digit hexidecimal format with zero padding if needed. π-l,--read-lockbitsβ read the lock bits from the target. the individual bits are also displayed with names. she's thorough like that. β¨-P,--part <name>β target device name (e.g.atmega16). normally, avarice autodetects the device via JTAG or debugWIRE. if this option is provided, it overrides the result from the autodetection. you're the boss, bestie. π-p,--programβ program the target. binary filename must be specified with--fileoption. NOTE: deprecated feature, must be enabled using the--enable-target-programmingconfiguration option. π§-R,--reset-srstβ applynSRSTsignal (external reset) when connecting. this can override applications that set theJTDbit. π-r,--read-fusesβ read fuses bytes.-V,--versionβ print version information. the "who even am I" option. π-v,--verifyβ verify program in device against file specified with--fileoption. NOTE: deprecated feature, must be enabled using the--enable-target-programmingconfiguration option. π§-w,--debugwireβ connect to JTAG ICE mkII, JTAGICE3, or AVR Dragon, talking debugWire protocol to the target. this option implies the-2option. see the DEBUGWIRE section below. π§-W,--write-fuses <eehhll>β write fuses bytes.eeis the extended fuse byte,hhis the high fuse byte andllis the low fuse byte. the fuse byte data must be given in two digit hexidecimal format with zero padding if needed. all three bytes must currently be given.
NOTE: current, if the target device doesn't have an extended fuse byte (e.g. theatmega16), the you should setee==llwhen writing the fuse bytes.
-x,--xmegaβ the target device is an ATxmega part, using JTAG transport. since the ATxmega uses a different JTAG communication than other AVRs, the normal device autodetection based on the JTAG ID does not work. if the device has been explicitly selected through the-Poption, it is not necessary to also specify the-xoption. π-X,--pdiβ the target device is an ATxmega part, using PDI transport.
and two little positional notes that live down here at the bottom of the options, because that's where they were and we respect the layout:
HOST_NAMEdefaults to0.0.0.0(listen on any interface) if not given.:PORTis required to put avarice into gdb server mode. π₯
π EXAMPLE USAGE π
avarice --erase --program --file test.bin --jtag /dev/ttyS0 :4242
program the file test.bin into the JTAG ICE (mkI) connected to /dev/ttyS0 after erasing the device, then listen in GDB mode on the local port 4242. this functionality is deprecated, and no longer configured by default. use GDB's "load" command instead. π
avarice --jtag usb:1234 --mkII :4242
connect to the JTAG ICE mkII attached to USB which serial number ends in 1234, and listen in GDB mode on local port 4242. look at her go. π
π DEBUGGING WITH AVARICE π
okay bestie, so the JTAG ICE debugging environment? it has a few restrictions and changes, no cap:
- No "soft" breakpoints, and only three hardware breakpoints. The
breakcommand sets hardware breakpoints. The easiest way to deal with this restriction is to enable and disable breakpoints as needed. - Two 1-byte hardware watchpoints (but each hardware watchpoint takes away one hardware breakpoint). If you set a watchpoint on a variable which takes more than one byte, execution will be abysmally slow. Instead it is better to do the following:
watch *(char *)&myvariable
which watches the least significant byte of myvariable. iykyk π
- The Atmel AVR processors have a Harvard architecture (separate code and data buses). To distinguish data address 0 from code address 0,
avr-gdbadds0x800000to all data addresses. Bear this in mind when examining printed pointers, or when passing absolute addresses togdbcommands. fr fr, that offset will sneak up on you π
π¦ DEBUGWIRE π¦
The debugWire protocol is a proprietary protocol introduced by Atmel to allow debugging small AVR controllers that don't offer enough pins (and enough chip resources) to implement full JTAG.
The communication takes place over the /RESET pin which needs to be turned into a debugWire connection pin by programming the DWEN fuse (debugWire enable), using a normal programmer connection (in-system programming, high-voltage programming).
β οΈ bestie, listen: by enabling this fuse, the standard reset functionality of that pin will be lost, so any in-system programming will cease to work as it requires a functional/RESETpin. Thus it should be made absolutely sure there is a way back, like a device (as theSTK500, for example) that can handle high-voltage programming of the AVR.
Currently, avarice offers no option to turn off the DWEN fuse. However, avrdude offers the option to turn it off either through high-voltage programming, or by using the JTAG ICE mkII to first turn the target into an ISP-compatible mode, and then using normal ISP commands to change the fuse settings.
Note that the debugWire environment is further limited, compared to JTAG. It does not offer hardware breakpoints, so all breakpoints have to be implemented as software breakpoints by rewriting flash pages using BREAK instructions. Some memory spaces (fuse and lock bits) are not accessible through the debugWire protocol. it's giving "limited edition," and not in a fun way π
π SEE ALSO π
gdb(1)avrdude(1)avr-gdb(1)insight(1)avr-insight(1)ice-gdb(1)ice-insight(1)
π AUTHORS π
Avarice (up to version 1.5) was originally written by Scott Finneran with help from Peter Jansen. They did the work of figuring out the jtagice communication protocol before Atmel released the spec (appnote AVR060). absolute legends, honestly π«Ά
David Gay made major improvements bringing avarice up to 2.0. β¨
Joerg Wunsch reworked the code to abstract the JTAG ICE communication from the remainder, and then extended the code to support the JTAG ICE mkII protocol (see Atmel appnote AVR067), as well as the JTAGICE3 protocol. main character energy tbh π
and that's a wrap on avarice(1), bestie β source/version is the avarice(1) manual, dated October 15, 2018. go debug something iconic π
π¦ where this page comes from
- debian bookworm: avarice 2.14+svn427-1 Β· GPL-2.0-or-later
- debian trixie: avarice 2.14+svn427-2 Β· GPL-2.0-or-later
- ubuntu jammy: avarice 2.14+svn392-1 Β· GPL-2.0-or-later
- ubuntu noble: avarice 2.14+svn427-1 Β· GPL-2.0-or-later
- ubuntu questing: avarice 2.14+svn427-2
- ubuntu resolute: avarice 2.14+svn427-2build1 Β· GPL-2.0-or-later
- ubuntu stonking: avarice 2.14+svn427-2build1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms