[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 Terminal Mode Commands

In this mode, AVRDUDE only initializes communication with the MCU, and then awaits user commands on standard input. Commands and parameters may be abbreviated to the shortest unambiguous form. Terminal mode provides a command history using readline(3), so previously entered command lines can be recalled and edited.

The addr and len parameters of the dump, read, write, save and erase commands can be negative with the same syntax as substring computations in perl or python. The table below details their meaning with respect to an example memory of size sz=0x800.

addrlenMemory intervalComment
0/positivepositive[addr, addr+len-1]Note: len = end-start + 1
0/positivenegative[addr, sz+len]End is |len| bytes below memory size sz
negativepositive[sz+addr, …]Start is |addr| bytes below memory size
negativenegative[sz+addr, sz+len]Combining above two cases
anyzeroempty setNo action
0x700 12[0x700, 0x70b]Conventional use
1024 -257[0x400, 0x6ff]Size of memory is 2048 or 0x800
-512 512[0x600, 0x7ff]Last 512 bytes
-256 -1[0x700, 0x7ff]Last 256 bytes
0 49[0, 48]First 49 bytes
0 -49[0, 1999]All but the last 48 = |len+1| bytes
0 -1[0, 0x7ff]All memory without knowing its size

The following commands are implemented for all programmers:

dump memory addr len

Read from the specified memory interval (see above), and display in the usual hexadecimal and ASCII form.

dump memory addr

Read from memory addr as many bytes as the most recent dump memory addr len command with this very memory had specified (default 256 bytes), and display them.

dump memory

Continue dumping from the memory and location where the most recent dump command left off; if no previous dump command has addressed a memory an error message will be shown.

dump memory addr

Start reading from addr, all the way to the last memory address (deprecated: use dump memory addr -1).

dump memory

Read all bytes from the specified memory, and display them (deprecated: use dump memory 0 -1).

read

Can be used as an alias for dump.

write memory addr data[,] {data[,]}

Manually program the respective memory cells, starting at address addr, using the data items provided. The terminal implements reading from and writing to flash, EEPROM, bootrow and usersig type memories normally through a cache and paged access functions. All other memories are directly written to without use of a cache. Some older parts without paged access, depending on the programmer, might also have flash and EEPROM directly accessed without cache.

Items data can have the following formats:

TypeExampleSize (bytes)
String"Hello, world\n"varying
FileC:/My\ projects/blink.hexvarying
File with formatblink.hex:ivarying
Character'A'1
Binary integer0b1010101, 2, 4, or 8
Octal integer0123451, 2, 4, or 8
Decimal integer123451, 2, 4, or 8
Hexadecimal integer0x123451, 2, 4, or 8
Decimal float3.14159264
Hexadecimal float0xA.8p24
Decimal double3.141592653589793D8
Hexadecimal double0xA.8p2D8

data can be binary, octal, decimal or hexadecimal integers, floating point numbers or C-style strings and characters. If nothing matches, data will be interpreted as a name of a file containing data, which will be read and inserted at this point. In order to force the interpretation of a data item as file, e.g., when the file name would be understood as a number otherwise, the file name can be given a :f format specifier. In absence of a format suffix, the terminal will try to auto-detect the file format.

For integers, an optional case-insensitive suffix specifies the data size as in the table below:

LL

8 bytes / 64 bits

L

4 bytes / 32 bits

H or S

2 bytes / 16 bits

HH

1 byte / 8 bits

Suffix D indicates a 64-bit double, F a 32-bit float, whilst a floating point number without suffix defaults to 32-bit float. Hexadecimal floating point notation is supported. An ambiguous trailing suffix, e.g., 0x1.8D, is read as no-suffix float where D is part of the mantissa; use a zero exponent 0x1.8p0D to clarify.

An optional U suffix makes integers unsigned. Ordinary 0x hexadecimal and 0b binary integers are always treated as unsigned. +0x, -0x, +0b and -0b numbers with an explicit sign are treated as signed unless they have a U suffix. Unsigned integers cannot be larger than 2^64-1. If n is an unsigned integer then -n is also a valid unsigned integer as in C. Signed integers must fall into the [-2^63, 2^63-1] range or a correspondingly smaller range when a suffix specifies a smaller type.

Ordinary 0x hexadecimal and 0b binary integers with n hex digits (counting leading zeros) use the smallest size of one, two, four and eight bytes that can accommodate any n-digit hexadecimal/binary integer. If an integer suffix specifies a size explicitly the corresponding number of least significant bytes are written, and a warning shown if the number does not fit into the desired representation. Otherwise, unsigned integers occupy the smallest of one, two, four or eight bytes needed. Signed numbers are allowed to fit into the smallest signed or smallest unsigned representation: For example, 255 is stored as one byte as 255U would fit in one byte, though as a signed number it would not fit into a one-byte interval [-128, 127]. The number -1 is stored in one byte whilst -1U needs eight bytes as it is the same as 0xFFFFffffFFFFffffU.

One trailing comma at the end of data items is ignored to facilitate copy and paste of lists.

write memory addr data

The start address addr may be omitted if the size of the memory being written to is one byte.

write memory addr len data[,] {data[,]}

The ellipsis … form writes the data to the entire memory intervall addressed by addr len and, if necessary, pads the remaining space by repeating the last data item. The fill write command does not write beyond the specified memory area even if more data than needed were given.

save memory {addr len} file[:format]

Save one or more memory segments to a file in a format specified by the :format letter. The default is :r for raw binary. Each memory segment is described by an address and length pair. In absence of any memory segments the entire memory is saved to the file. Only Motorola S-Record (:s) and Intel Hex (:i or :I) formats store address information with the saved data. Avrdude cannot currently save ELF file formats. All the other file formats lose the address information and concatenate the chosen memory segments into the output file. If the file name is - then avrdude writes to stdout.

erase

Perform a chip erase and discard all pending writes to EEPROM and flash. Note that EEPROM will be preserved if the EESAVE fuse bit is set.

erase memory

Erase the entire specified memory.

erase memory addr len

Erase a section of the specified memory.

flush

Synchronise with the device all pending writes to flash, EEPROM, bootrow and usersig. With some programmer and part combinations, flash (and sometimes EEPROM, too) looks like a NOR memory, i.e., a write can only clear bits, never set them. For NOR memories a page erase or, if not available, a chip erase needs to be issued before writing arbitrary data. Bootrow and usersig are generally unaffected by a chip erase. When a memory looks like a NOR memory, either page erase is deployed (e.g., with parts that have PDI/UPDI interfaces), or if that is not available, both EEPROM and flash caches are fully read in, a chip erase command is issued and both EEPROM and flash are written back to the device. Hence, it can take minutes to ensure that a single previously cleared bit is set and, therefore, this routine should be called sparingly.

abort

Normally, caches are only ever actually written to the device when using flush, at the end of the terminal session after typing quit, or after EOF on input is encountered. The abort command resets the cache discarding all previous writes to the flash, EEPROM, bootrow and usersig cache.

config [opts]

Show all configuration properties of the part; these are usually bitfields in fuses or lock bits bytes that can take on values, which typically have a mnemonic name. Each part has their own set of configurable items. The option -f groups the configuration properties by the fuses and lock bits byte they are housed in, and shows the current value of these memories as well. Config -a outputs an initialisation script with all properties and all possible respective assignments. The currently assigned mnemonic values are the ones that are not commented out. The option -v increases the verbosity of the output of the config command.

config [opts] property [opts]

Show the current value of the named configuration property. Wildcards or initial strings are permitted (but not both), in which case the current values of all matching properties are displayed.

config [opts] property= [opts]

Show all possible values of the named configuration property (notice the trailing =). The one that is currently set is the only one not commented out. As before, wildcards or initial strings are permitted.

config [opts] property=value [opts]

Modify the named configuration property to the given value. The corresponding fuse or lock bits will be changed immediately but the change will normally only take effect the next time the part is reset, at which point the fuses and lock bits are utilised. Value can either be a valid integer or one of the symbolic mnemonics, if known. Wildcards or initial strings are permitted for either the property or the assigned mnemonic value, but an assignment only happens if both the property and the name can be uniquely resolved.

It is quite possible, as is with direct writing to the underlying fuses and lock bits, to brick a part, i.e., make it unresponsive to further programming with the chosen programmer: here be dragons.

factory reset

Resets the connected part to factory state as far as possible (bootloaders, for example, cannot write fuses and may not have a means to erase EEPROM). This command may change the clock frequency F_CPU of the part after the next MCU reset when the changed fuse values come into effect. As such, this may require that future avrdude calls use a different bit clock rate up to F_CPU/4 for the programmer next time. Note that the command factory can be abbreviated but the required argument reset needs to be spelled out in full.

regfile [opts]

regfile with no further argument displays the register file of a part, i.e., all register names and their contents in io memory, if possible: note that external programming cannot read the registers of classic parts (ISP or TPI interfaces).

Option -a displays the register I/O addresses in addition; -m displays the register memory addresses used for lds/sts opcodes instead of the I/O addresses. Option -s also shows the size of the register in bytes whilst -v shows a slightly expanded register explanation alongside each register.

regfile [opts] reg [opts]

regfile together with a register name reg shows all those registers that are matched by reg. Wildcards or partial strings are permitted but not both. Register names have the form module.name or module.instance.name. If the provided reg is a full, existing register name, e.g., porta.out then that is the only register that is displayed even though that might be a partial name of another register, eg, porta.outdir. If the provided reg is the same as instance.name or name then partial matching is no longer utilised and all module registers with that exact instance.name or name are shown. Partial matching can be forced through use of wildcards, e.g., using porta.out*

regfile [opts] reg=value [opts]

This sets a single register addressed by reg to the given value. Only external programming of modern parts (those with UPDI interface) can read from and write to register io memory, but as that memory is volatile, the contents will be lost after reset.

include [opts] file

Include contents of the named file file as if it was typed. This is useful for batch scripts, e.g., recurring initialisation code for fuses. The include option -e prints the lines of the file as comments before processing them; on a non-zero verbosity level the line numbers are printed, too.

signature

Display the device signature bytes.

part

Display the current part information, including supported programming modes, memory and variants tables. Use -m to only print the memory table, and -v to only print the variants table.

verbose [level]

Change (when level is provided), or display the verbosity level. The initial verbosity level is controlled by the number of -v options given on the command line.

quell [level]

Change (when level is provided), or display the quell level. 1 is used to suppress progress reports. 2 or higher yields progressively quieter operations. The initial quell level is controlled by the number of -q options given on the command line.

?
help

Give a short on-line summary of the available commands.

quit

Leave terminal mode and thus AVRDUDE.

q

Can be used as an alias for quit.

!line

Run the shell line in a subshell, e.g., !ls *.hex. Subshell commands take the rest of the line as their command. For security reasons, they must be enabled explictly by putting allow_subshells = yes; into your ${HOME}/.config/avrdude/avrdude.rc or ${HOME}/.avrduderc file.

# comment

Place comments onto the terminal line (useful for scripts).

In addition, the following commands are supported on some programmers:

pgerase memory addr

Erase one page of the memory specified.

send b1 b2 b3 b4

Send raw instruction codes to the AVR device. If you need access to a feature of an AVR part that is not directly supported by AVRDUDE, this command allows you to use it, even though AVRDUDE does not implement the command. When using direct SPI mode, up to 3 bytes can be omitted.

spi

Enter direct SPI mode. The pgmled pin acts as chip select. Only supported on parallel bitbang programmers, and partially by USBtiny. Chip Select must be externally held low for direct SPI when using USBtinyISP, and send must be a multiple of four bytes.

pgm

Return to programming mode (from direct SPI mode).

vtarg voltage

Set the target’s supply voltage to voltage Volts.

varef [channel] voltage

Set the adjustable voltage source to voltage Volts. This voltage is normally used to drive the target’s Aref input on the STK500 and STK600. The STK600 offers two reference voltages, which can be selected by the optional parameter channel (either 0 or 1).

fosc freq[M|k]

Set the programming oscillator to freq Hz. An optional trailing letter M multiplies by 1E6, a trailing letter k by 1E3.

fosc off

Turn the programming oscillator off.

sck period

Set the SCK clock period to period microseconds. Note that some official Microchip programmers store the bitclock setting and will continue to use it until a diferent value is provided. See -B bitclock for more information.

parms

Display programmer specific parameters.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on February 8, 2024 using texi2html 1.82.