File: using-avrprog.dox

package info (click to toggle)
avr-libc 1%3A1.6.2.cvs20080610-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 14,848 kB
  • ctags: 55,619
  • sloc: ansic: 92,267; asm: 6,692; sh: 4,131; makefile: 2,481; python: 976; pascal: 426; perl: 116
file content (129 lines) | stat: -rw-r--r-- 4,905 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* Copyright (c) 2002, Brian Dean
   All rights reserved.

   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions are met:

   * Redistributions of source code must retain the above copyright
     notice, this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
     distribution.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  POSSIBILITY OF SUCH DAMAGE. */

/* $Id: using-avrprog.dox,v 1.2 2003/02/27 18:32:46 troth Exp $ */

/** \page using_avrprog Using the avrdude program

\addindex avrprog, usage
\addindex avrdude, usage

\note This section was contributed by Brian Dean [ bsd@bsdhome.com ].

\note The avrdude program was previously called avrprog. The name was changed
to avoid confusion with the avrprog program that Atmel ships with AvrStudio.

\c avrdude is a program that is used to update or read the flash and EEPROM
memories of Atmel AVR microcontrollers on FreeBSD Unix. It supports the Atmel
serial programming protocol using the PC's parallel port and can upload either
a raw binary file or an Intel Hex format file. It can also be used in an
interactive mode to individually update EEPROM cells, fuse bits, and/or lock
bits (if their access is supported by the Atmel serial programming protocol.)
The main flash instruction memory of the AVR can also be programmed in
interactive mode, however this is not very useful because one can only turn
bits off. The only way to turn flash bits on is to erase the entire memory
(using <tt>avrdude</tt>'s \c -e option).

\c avrdude is part of the FreeBSD ports system. To install it, simply do the
following:

\verbatim
# cd /usr/ports/devel/avrdude
# make install
\endverbatim

Once installed, \c avrdude can program processors using the contents of the \c
.hex file specified on the command line. In this example, the file \c main.hex
is burned into the flash memory:

\verbatim
# avrdude -p 2313 -e -m flash -i main.hex

avrdude: AVR device initialized and ready to accept instructions

avrdude: Device signature = 0x1e9101

avrdude: erasing chip
avrdude: done.
avrdude: reading input file "main.hex"
avrdude: input file main.hex auto detected as Intel Hex

avrdude: writing flash:
1749 0x00
avrdude: 1750 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: reading on-chip flash data:
1749  0x00
avrdude: verifying ...
avrdude: 1750 bytes of flash verified

avrdude done.  Thank you.
\endverbatim

The <tt>-p 2313</tt> option lets \c avrdude know that we are operating on an
AT90S2313 chip. This option specifies the device id and is matched up with the
device of the same id in <tt>avrdude</tt>'s configuration file ( \c
/usr/local/etc/avrdude.conf ). To list valid parts, specify the \c -v
option. The \c -e option instructs \c avrdude to perform a chip-erase before
programming; this is almost always necessary before programming the flash. The
<tt>-m flash</tt> option indicates that we want to upload data into the flash
memory, while <tt>-i main.hex</tt> specifies the name of the input file.

The EEPROM is uploaded in the same way, the only difference is that you would
use <tt>-m eeprom</tt> instead of <tt>-m flash</tt>.

To use interactive mode, use the <tt>-t</tt> option:

\verbatim
# avrdude -p 2313 -t
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e9101
avrdude>

The '?' command displays a list of valid
commands:

avrdude> ?
>>> ?
Valid commands:

  dump   : dump memory  : dump <memtype> <addr> <N-Bytes>
  read   : alias for dump
  write  : write memory : write <memtype> <addr> <b1> <b2> ... <bN>
  erase  : perform a chip erase
  sig    : display device signature bytes
  part   : display the current part information
  send   : send a raw command : send <b1> <b2> <b3> <b4>
  help   : help
  ?      : help
  quit   : quit

Use the 'part' command to display valid memory types for use with the
'dump' and 'write' commands.

avrdude>
\endverbatim

*/