| 1 |
# |
| 2 |
# avarice - The "avarice" program. |
| 3 |
# Copyright (C) 2001, 2003 Scott Finneran |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 2 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. |
| 18 |
# |
| 19 |
# doc/running.txt |
| 20 |
# |
| 21 |
|
| 22 |
NOTE: This file is _really_ old and hasn't been kept up to date. Start avarice |
| 23 |
with the --help option to get the current list of options. |
| 24 |
|
| 25 |
Using AVaRICE: |
| 26 |
-------------- |
| 27 |
|
| 28 |
> bin/avarice |
| 29 |
avrjtagd version 1.0.D084, Nov 12 2001 14:47:08 |
| 30 |
|
| 31 |
Usage: bl/bin/avarice [OPTION]... <host-name> <port> |
| 32 |
|
| 33 |
Options: |
| 34 |
-d, --debug Enable printing of debug information |
| 35 |
-f, --file <filename> Download specified file prior to debugging |
| 36 |
|
| 37 |
-j, --jtag <devname> Port attached to JTAG box (default: /dev/avrjtag) |
| 38 |
|
| 39 |
Required info: |
| 40 |
<host-name> : This is the name of the machine attached to the JTAG box. |
| 41 |
<port> : This is a unique spare IP port number on that machine. |
| 42 |
|
| 43 |
e.g. bl/bin/avarice --file test.bin --jtag /dev/ttyS0 localhost 4242 |
| 44 |
|
| 45 |
Hints/notes: |
| 46 |
- The default jtag port is /dev/avrjtag. Rather than enter a serial port |
| 47 |
every time, why not add a symlink. |
| 48 |
eg. ln -s /dev/ttyS0 /dev/avrjtag |
| 49 |
|
| 50 |
- VERY IMPORTANT: the file specified on the avarice command line needs |
| 51 |
to be a BINARY FILE (ie not the elf object file loaded into gdb). This |
| 52 |
can be easily created from the elf file using avr-objcopy. |
| 53 |
|
| 54 |
|
| 55 |
Up and Running with avr-gdb: |
| 56 |
---------------------------- |
| 57 |
1. Apply the standard avr patch to avr-gdb and compile away! |
| 58 |
I used the standard distro of gdb (http://sources.redhat.com/gdb/) |
| 59 |
and patched it with: |
| 60 |
(http://www.amelek.gda.pl/avr/gdb/gdb-5.0-avr-patch-0.1.gz) |
| 61 |
|
| 62 |
note: This patch has a minor problem which breaks the "info registers" |
| 63 |
command. To fix this, edit gdb/config/avr/tm-avr.h:314 to read: |
| 64 |
#undef GET_SAVED_REGISTER |
| 65 |
|
| 66 |
note: Ted Roth ([email protected]) has identified a LARGE number of |
| 67 |
problems with the above patch to gdb. He is currently working on a |
| 68 |
series of fixes. Snapshots of his latest work can be found at: |
| 69 |
(http://freesoftware.fsf.org/download/simulavr/gdb-patches/) |
| 70 |
I would recommend using these over the original patches for |
| 71 |
now. Feedback would be helpful or better still, lend Ted a hand! |
| 72 |
|
| 73 |
2. Once installed, run avr-gdb and load in your final avr-elf file. The |
| 74 |
simplest way is of course: |
| 75 |
|
| 76 |
avr-gdb target.elf |
| 77 |
|
| 78 |
|
| 79 |
note: Step 3 really is not needed with my latest patches. Also, don't count on |
| 80 |
.avrgdbinit being around in the future due to changes in gdb's design |
| 81 |
for 5.2. Just use .gdbinit in the working directory, not |
| 82 |
~/.gdbinit or ~/.avrgddinit. TRoth 14 Feb 2002 |
| 83 |
|
| 84 |
3. AVR-GDB will need the following config items set (ie enter the following cmds): |
| 85 |
|
| 86 |
set remoteaddresssize 32 |
| 87 |
set remote Z-packet enable |
| 88 |
|
| 89 |
There are a few ways to do this: |
| 90 |
|
| 91 |
- Enter them manually when you start avr-gdb |
| 92 |
- Dump these commands into a text file and run avr-gdb with the -x option. |
| 93 |
- Dump these commands into ~/.gdbinit. |
| 94 |
Note: chances are that your hosts' version of gdb also uses the same |
| 95 |
filename for its config. Probably best not to get the two confused. |
| 96 |
|
| 97 |
That said, thanks to Ted Roth for suggesting the following: |
| 98 |
|
| 99 |
In the sources for GDB, add the following 2 lines to gdb/config/avr/tm-avr.h |
| 100 |
/* Rename .gdbinit to aid in debugging. */ |
| 101 |
#define GDBINIT_FILENAME ".avrgdbinit" |
| 102 |
This gives avr-gdb a unique config filename. |
| 103 |
|
| 104 |
He has also submitted an example .avrgdbinit file: |
| 105 |
|
| 106 |
echo loading demo.elf\n |
| 107 |
file demo.elf |
| 108 |
|
| 109 |
echo Setting remote addr size to 32\n |
| 110 |
set remoteaddresssize 32 |
| 111 |
|
| 112 |
echo Connecting to remote target\n |
| 113 |
target remote localhost:1212 |
| 114 |
|
| 115 |
echo Downloading program to target\n |
| 116 |
load |
| 117 |
|
| 118 |
Please note, at this time, avarice does not support GDB's load |
| 119 |
command. It is on the todo list. |
| 120 |
|
| 121 |
|
| 122 |
4. Run avarice (refer above): |
| 123 |
|
| 124 |
5. Enter the following command: |
| 125 |
|
| 126 |
target remote HOST:PORT e.g. target remote localhost:4242 |
| 127 |
|
| 128 |
The HOST:PORT need to match the values entered on the avarice command |
| 129 |
line for <host-name> <port> (refer above). |
| 130 |
|
| 131 |
6. Something along these lines should greet you: |
| 132 |
GNU gdb 5.0 |
| 133 |
Copyright 2000 Free Software Foundation, Inc. |
| 134 |
GDB is free software, covered by the GNU General Public License, and you are |
| 135 |
welcome to change it and/or distribute copies of it under certain conditions. |
| 136 |
Type "show copying" to see the conditions. |
| 137 |
There is absolutely no warranty for GDB. Type "show warranty" for details. |
| 138 |
This GDB was configured as "--host=i686-pc-linux-gnu --target=avr"... |
| 139 |
(gdb) target remote localhost:4242 |
| 140 |
Remote debugging using localhost:4242 |
| 141 |
0x0 in .__start_of_init__ () |
| 142 |
|
| 143 |
7. The normal gdb "run" command doesn't seem to have that much meaning |
| 144 |
here (read the gdb doco with reference to the remote debug |
| 145 |
protocol). As such, use the "continue" command to kick off your |
| 146 |
program. |