| 1 |
27 |
unneback |
===========================================================================
|
| 2 |
|
|
#####ECOSGPLCOPYRIGHTBEGIN####
|
| 3 |
|
|
## -------------------------------------------
|
| 4 |
|
|
## This file is part of eCos, the Embedded Configurable Operating System.
|
| 5 |
|
|
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
| 6 |
|
|
##
|
| 7 |
|
|
## eCos is free software; you can redistribute it and/or modify it under
|
| 8 |
|
|
## the terms of the GNU General Public License as published by the Free
|
| 9 |
|
|
## Software Foundation; either version 2 or (at your option) any later version.
|
| 10 |
|
|
##
|
| 11 |
|
|
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
| 12 |
|
|
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
| 13 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
| 14 |
|
|
## for more details.
|
| 15 |
|
|
##
|
| 16 |
|
|
## You should have received a copy of the GNU General Public License along
|
| 17 |
|
|
## with eCos; if not, write to the Free Software Foundation, Inc.,
|
| 18 |
|
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
| 19 |
|
|
##
|
| 20 |
|
|
## As a special exception, if other files instantiate templates or use macros
|
| 21 |
|
|
## or inline functions from this file, or you compile this file and link it
|
| 22 |
|
|
## with other works to produce a work based on this file, this file does not
|
| 23 |
|
|
## by itself cause the resulting work to be covered by the GNU General Public
|
| 24 |
|
|
## License. However the source code for this file must still be made available
|
| 25 |
|
|
## in accordance with section (3) of the GNU General Public License.
|
| 26 |
|
|
##
|
| 27 |
|
|
## This exception does not invalidate any other reasons why a work based on
|
| 28 |
|
|
## this file might be covered by the GNU General Public License.
|
| 29 |
|
|
##
|
| 30 |
|
|
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
| 31 |
|
|
## at http://sources.redhat.com/ecos/ecos-license/
|
| 32 |
|
|
## -------------------------------------------
|
| 33 |
|
|
#####ECOSGPLCOPYRIGHTEND####
|
| 34 |
|
|
===========================================================================
|
| 35 |
|
|
|
| 36 |
|
|
1999-01-05, revised 1999-03-11, revised 2000.01.26
|
| 37 |
|
|
|
| 38 |
|
|
How to build and install the GDB module on the AEB-1
|
| 39 |
|
|
====================================================
|
| 40 |
|
|
|
| 41 |
|
|
Overview
|
| 42 |
|
|
--------
|
| 43 |
|
|
|
| 44 |
|
|
The ARM AEB-1 comes with tools in ROM. These include a simple FLASH
|
| 45 |
|
|
management tool and the Angel (R) monitor. eCos for the ARM AEB-1
|
| 46 |
|
|
comes with GDB stubs suitable for programming into the onboard FLASH.
|
| 47 |
|
|
GDB is the preferred debug environment for eCos, but Angel must be
|
| 48 |
|
|
used to initially install the GDB stubs.
|
| 49 |
|
|
|
| 50 |
|
|
Once this bootstrapping is done, you can use GDB to load and debug
|
| 51 |
|
|
programs on the AEB-1 board.
|
| 52 |
|
|
|
| 53 |
|
|
The following steps will have you:
|
| 54 |
|
|
|
| 55 |
|
|
* talk to the AEB-1 board with a terminal emulator (or a real
|
| 56 |
|
|
terminal!)
|
| 57 |
|
|
|
| 58 |
|
|
* enable ARM's Angel ROM monitor
|
| 59 |
|
|
|
| 60 |
|
|
* use GDB with Angel or the Angel ROM monitor to download a
|
| 61 |
|
|
configuration of eCos with GDB stubs which will act as a ROM monitor
|
| 62 |
|
|
|
| 63 |
|
|
* talk to the AEB-1 with a terminal emulator again, and tell it to
|
| 64 |
|
|
write the new module to flash
|
| 65 |
|
|
|
| 66 |
|
|
* tell the board to use this new monitor, and then hook GDB up to it
|
| 67 |
|
|
for real debugging
|
| 68 |
|
|
|
| 69 |
|
|
Talking to the board
|
| 70 |
|
|
--------------------
|
| 71 |
|
|
|
| 72 |
|
|
Connect a terminal or computer's serial port to the ARM AEB-1. On a
|
| 73 |
|
|
PC with a 9-pin serial port, you can use the cable shipped by ARM with
|
| 74 |
|
|
no modification.
|
| 75 |
|
|
|
| 76 |
|
|
Set the terminal or terminal emulator to 9600N1 (9600 baud, no parity,
|
| 77 |
|
|
1 stop bit).
|
| 78 |
|
|
|
| 79 |
|
|
Reset the board by pressing the little reset button on the top. You
|
| 80 |
|
|
will see the following text:
|
| 81 |
|
|
|
| 82 |
|
|
ARM Evaluation Board Boot Monitor 0.01 (19 APR 1998)
|
| 83 |
|
|
Press ENTER within 2 seconds to stop autoboot
|
| 84 |
|
|
|
| 85 |
|
|
Press ENTER quickly, and you will get the boot prompt:
|
| 86 |
|
|
|
| 87 |
|
|
Boot:
|
| 88 |
|
|
|
| 89 |
|
|
|
| 90 |
|
|
Downloading the GDB stubs
|
| 91 |
|
|
-------------------------
|
| 92 |
|
|
|
| 93 |
|
|
Run the angel monitor by typing the following at the Boot: prompt:
|
| 94 |
|
|
|
| 95 |
|
|
Boot: plugin angel
|
| 96 |
|
|
Boot: angel
|
| 97 |
|
|
|
| 98 |
|
|
Then exit the terminal emulator and start up gdb with the GDB module:
|
| 99 |
|
|
|
| 100 |
|
|
$ arm-elf-gdb -nw loaders/arm-aeb/gdb_module.img
|
| 101 |
|
|
(gdb) set remotebaud 9600
|
| 102 |
|
|
(gdb) target rdi s=
|
| 103 |
|
|
|
| 104 |
|
|
On Windows, the serial port could be com1, com2, etc. On a UNIX or
|
| 105 |
|
|
Linux system, the serial port would be /dev/cua0 or /dev/cua1.
|
| 106 |
|
|
Examples are:
|
| 107 |
|
|
|
| 108 |
|
|
(gdb) target rdi s=com1
|
| 109 |
|
|
(gdb) target rdi s=/dev/cua0
|
| 110 |
|
|
|
| 111 |
|
|
Finally, load the GDB stubs image:
|
| 112 |
|
|
|
| 113 |
|
|
(gdb) load
|
| 114 |
|
|
Loading section .rom_vectors, size 0x44 lma 0xc000
|
| 115 |
|
|
Loading section .text, size 0x3544 lma 0xc044
|
| 116 |
|
|
Loading section .rodata, size 0x164 lma 0xf588
|
| 117 |
|
|
Loading section .data, size 0x110 lma 0xf6ec
|
| 118 |
|
|
Start address 0xc044 , load size 14332
|
| 119 |
|
|
Transfer rate: 12739 bits/sec.
|
| 120 |
|
|
|
| 121 |
|
|
(Note that the sizes may not exactly match the ones you see on your
|
| 122 |
|
|
system.)
|
| 123 |
|
|
|
| 124 |
|
|
Once the loading is done, quit GDB:
|
| 125 |
|
|
|
| 126 |
|
|
(gdb) quit
|
| 127 |
|
|
|
| 128 |
|
|
|
| 129 |
|
|
Activating the GDB stubs
|
| 130 |
|
|
------------------------
|
| 131 |
|
|
|
| 132 |
|
|
Connect a terminal emulator to the board again, reset the board, and
|
| 133 |
|
|
type enter within two seconds to get the Boot: prompt. This is the
|
| 134 |
|
|
same thing you did at the beginning of this procedure.
|
| 135 |
|
|
|
| 136 |
|
|
Commit the GDB stubs module to flash:
|
| 137 |
|
|
|
| 138 |
|
|
Boot: flashwrite 4018000 C000 8000
|
| 139 |
|
|
|
| 140 |
|
|
Verify that the eCos/"GDB stubs" module is now added in the list of
|
| 141 |
|
|
modules in the board:
|
| 142 |
|
|
|
| 143 |
|
|
Boot: rommodules
|
| 144 |
|
|
|
| 145 |
|
|
You should see the following output:
|
| 146 |
|
|
|
| 147 |
|
|
Header Base Limit
|
| 148 |
|
|
04000004 04000000 040034a8 BootStrap 1.00 (14 Aug 1998)
|
| 149 |
|
|
04003a74 04003800 04003bc0 Production Test 1.00 (13 Aug 1998)
|
| 150 |
|
|
0400e4f4 04004000 0400e60f Angel 1.02 (12 MAY 1998)
|
| 151 |
|
|
0401ac00 04018000 0401aed8 eCos 1.2 (26 Feb 1999) GDB stubs
|
| 152 |
|
|
|
| 153 |
|
|
Now make the eCos/"GDB stubs" module be the default monitor:
|
| 154 |
|
|
|
| 155 |
|
|
Boot: plugin eCos
|
| 156 |
|
|
|
| 157 |
|
|
|
| 158 |
|
|
Running and debugging an application
|
| 159 |
|
|
------------------------------------
|
| 160 |
|
|
|
| 161 |
|
|
Configure eCos from scratch for the ARM AEB-1 platform, and build your
|
| 162 |
|
|
application. Remember that the AEB-1 board only has 128K of RAM.
|
| 163 |
|
|
|
| 164 |
|
|
Exit from the terminal emulator (you will not need it anymore for
|
| 165 |
|
|
normal operations), and run gdb:
|
| 166 |
|
|
|
| 167 |
|
|
$ arm-elf-gdb -nw executable
|
| 168 |
|
|
(gdb) set remotebaud 38400
|
| 169 |
|
|
(gdb) target remote
|
| 170 |
|
|
(gdb) load
|
| 171 |
|
|
|
| 172 |
|
|
You can now run your program in the usual way under GDB'S control
|
| 173 |
|
|
|
| 174 |
|
|
Notice that the GDB stub runs at 38400 baud.
|
| 175 |
|
|
|
| 176 |
|
|
|
| 177 |
|
|
Building the GDB stubs
|
| 178 |
|
|
----------------------
|
| 179 |
|
|
|
| 180 |
|
|
We provide the GDB stubs image in the directory
|
| 181 |
|
|
loaders/arm-aeb/gdb_module.img, but here are instructions on how to
|
| 182 |
|
|
rebuild them if you should ever need to.
|
| 183 |
|
|
|
| 184 |
|
|
% ecosconfig new aeb stubs
|
| 185 |
|
|
% ecosconfig tree
|
| 186 |
|
|
% make
|
| 187 |
|
|
|
| 188 |
|
|
The newlt built files are installed in ./bin/install.
|
| 189 |
|
|
|
| 190 |
|
|
|
| 191 |
|
|
Alternate way of loading the initial stubs
|
| 192 |
|
|
------------------------------------------
|
| 193 |
|
|
|
| 194 |
|
|
Using the AEB-1 module tool, install the GDB stubs from the provided
|
| 195 |
|
|
".UU" file.
|
| 196 |
|
|
|
| 197 |
|
|
>>> This is an annotated 'terminal' session with the AEB-1 monitor:
|
| 198 |
|
|
|
| 199 |
|
|
ARM Evaluation Board Boot Monitor 0.01 (19 APR 1998)
|
| 200 |
|
|
Press ENTER within 2 seconds to stop autoboot
|
| 201 |
|
|
Boot: help
|
| 202 |
|
|
Module is BootStrap 1.00 (14 Aug 1998)
|
| 203 |
|
|
|
| 204 |
|
|
Help is available on:
|
| 205 |
|
|
Help Modules ROMModules UnPlug PlugIn
|
| 206 |
|
|
Kill SetEnv UnSetEnv PrintEnv DownLoad
|
| 207 |
|
|
Go GoS Boot PC FlashWrite
|
| 208 |
|
|
FlashLoad FlashErase
|
| 209 |
|
|
|
| 210 |
|
|
Boot: download c000
|
| 211 |
|
|
Ready to download. Use 'transmit' option on terminal emulator to download file.
|
| 212 |
|
|
|
| 213 |
|
|
... at this point, I told my terminal emulator (minicom) to download
|
| 214 |
|
|
the ASCII file gdb_module.img.UU (probably needs a different name
|
| 215 |
|
|
on Win/NT) I had to enter ^D when the download was complete to
|
| 216 |
|
|
get the monitor to come back.
|
| 217 |
|
|
|
| 218 |
|
|
Loaded file gdb_module.img.raw at address 0000c000, size = 13905
|
| 219 |
|
|
|
| 220 |
|
|
Boot: flashwrite 4018000 c000 8000
|
| 221 |
|
|
|
| 222 |
|
|
As above, this command actually programs the FLASH.
|
| 223 |
|
|
|
| 224 |
|
|
Boot: rommodules
|
| 225 |
|
|
Header Base Limit
|
| 226 |
|
|
04000004 04000000 040034a8 BootStrap 1.00 (14 Aug 1998)
|
| 227 |
|
|
04003a74 04003800 04003bc0 Production Test 1.00 (13 Aug 1998)
|
| 228 |
|
|
0400e4f4 04004000 0400e60f Angel 1.02 (12 MAY 1998)
|
| 229 |
|
|
0401b608 04018000 0401b844 eCos 1.3 (Jan 26 2000) GDB stubs
|
| 230 |
|
|
|
| 231 |
|
|
This verifies that the eCos GDB stubs are available in FLASH.
|
| 232 |
|
|
|
| 233 |
|
|
Boot: plugin ecos
|
| 234 |
|
|
|
| 235 |
|
|
This makes the eCos GDB stubs the default "monitor." When reset the
|
| 236 |
|
|
AEB-1 will start the GDB stubs, after the initial 2 second escape
|
| 237 |
|
|
period.
|