|
2
|
1 =========================================================================== |
|
|
2 ####COPYRIGHTBEGIN#### |
|
|
3 |
|
|
4 ------------------------------------------- |
|
|
5 The contents of this file are subject to the Cygnus eCos Public License |
|
|
6 Version 1.0 (the "License"); you may not use this file except in |
|
|
7 compliance with the License. You may obtain a copy of the License at |
|
|
8 http://sourceware.cygnus.com/ecos |
|
|
9 |
|
|
10 Software distributed under the License is distributed on an "AS IS" |
|
|
11 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
|
12 License for the specific language governing rights and limitations under |
|
|
13 the License. |
|
|
14 |
|
|
15 The Original Code is eCos - Embedded Cygnus Operating System, released |
|
|
16 September 30, 1998. |
|
|
17 |
|
|
18 The Initial Developer of the Original Code is Cygnus. Portions created |
|
|
19 by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved. |
|
|
20 ------------------------------------------- |
|
|
21 |
|
|
22 ####COPYRIGHTEND#### |
|
|
23 =========================================================================== |
|
|
24 |
|
|
25 1999-01-05, revised 1999-03-11 |
|
|
26 |
|
|
27 How to build and install the GDB module on the AEB-1 |
|
|
28 ==================================================== |
|
|
29 |
|
|
30 Overview |
|
|
31 -------- |
|
|
32 |
|
|
33 The ARM AEB-1 comes with tools in ROM. These include a simple FLASH |
|
|
34 management tool and the Angel (R) monitor. eCos for the ARM AEB-1 |
|
|
35 comes with GDB stubs suitable for programming into the onboard FLASH. |
|
|
36 GDB is the preferred debug environment for eCos, but Angel must be |
|
|
37 used to initially install the GDB stubs. |
|
|
38 |
|
|
39 Once this bootstrapping is done, you can use GDB to load and debug |
|
|
40 programs on the AEB-1 board. |
|
|
41 |
|
|
42 The following steps will have you: |
|
|
43 |
|
|
44 * talk to the AEB-1 board with a terminal emulator (or a real |
|
|
45 terminal!) |
|
|
46 |
|
|
47 * enable ARM's Angel ROM monitor |
|
|
48 |
|
|
49 * use GDB with Angel to download a configuration of eCos with GDB |
|
|
50 stubs which will act as a ROM monitor |
|
|
51 |
|
|
52 * talk to the AEB-1 with a terminal emulator again, and tell it to |
|
|
53 write the new module to flash |
|
|
54 |
|
|
55 * tell the board to use this new monitor, and then hook GDB up to it |
|
|
56 for real debugging |
|
|
57 |
|
|
58 Talking to the board |
|
|
59 -------------------- |
|
|
60 |
|
|
61 Connect a terminal or computer's serial port to the ARM AEB-1. On a |
|
|
62 PC with a 9-pin serial port, you can use the cable shipped by ARM with |
|
|
63 no modification. |
|
|
64 |
|
|
65 Set the terminal or terminal emulator to 9600N1 (9600 baud, no parity, |
|
|
66 1 stop bit). |
|
|
67 |
|
|
68 Reset the board by pressing the little reset button on the top. You |
|
|
69 will see the following text: |
|
|
70 |
|
|
71 ARM Evaluation Board Boot Monitor 0.01 (19 APR 1998) |
|
|
72 Press ENTER within 2 seconds to stop autoboot |
|
|
73 |
|
|
74 Press ENTER quickly, and you will get the boot prompt: |
|
|
75 |
|
|
76 Boot: |
|
|
77 |
|
|
78 |
|
|
79 Downloading the GDB stubs |
|
|
80 ------------------------- |
|
|
81 |
|
|
82 Run the angel monitor by typing the following at the Boot: prompt: |
|
|
83 |
|
|
84 Boot: plugin angel |
|
|
85 Boot: angel |
|
|
86 |
|
|
87 Then exit the terminal emulator and start up gdb with the GDB module: |
|
|
88 |
|
|
89 $ arm-elf-gdb -nw loaders/arm-aeb/gdb_module.img |
|
|
90 (gdb) set remotebaud 9600 |
|
|
91 (gdb) target rdi s=<YOUR SERIAL PORT> |
|
|
92 |
|
|
93 On Windows, the serial port could be com1, com2, etc. On a UNIX or |
|
|
94 Linux system, the serial port would be /dev/cua0 or /dev/cua1. |
|
|
95 Examples are: |
|
|
96 |
|
|
97 (gdb) target rdi s=com1 |
|
|
98 (gdb) target rdi s=/dev/cua0 |
|
|
99 |
|
|
100 Finally, load the GDB stubs image: |
|
|
101 |
|
|
102 (gdb) load |
|
|
103 Loading section .rom_vectors, size 0x44 lma 0xc000 |
|
|
104 Loading section .text, size 0x3544 lma 0xc044 |
|
|
105 Loading section .rodata, size 0x164 lma 0xf588 |
|
|
106 Loading section .data, size 0x110 lma 0xf6ec |
|
|
107 Start address 0xc044 , load size 14332 |
|
|
108 Transfer rate: 12739 bits/sec. |
|
|
109 |
|
|
110 (Note that the sizes may not exactly match the ones you see on your |
|
|
111 system.) |
|
|
112 |
|
|
113 Once the loading is done, quit GDB: |
|
|
114 |
|
|
115 (gdb) quit |
|
|
116 |
|
|
117 |
|
|
118 Activating the GDB stubs |
|
|
119 ------------------------ |
|
|
120 |
|
|
121 Connect a terminal emulator to the board again, reset the board, and |
|
|
122 type enter within two seconds to get the Boot: prompt. This is the |
|
|
123 same thing you did at the beginning of this procedure. |
|
|
124 |
|
|
125 Commit the GDB stubs module to flash: |
|
|
126 |
|
|
127 Boot: flashwrite 4018000 C000 8000 |
|
|
128 |
|
|
129 Verify that the eCos/"GDB stubs" module is now added in the list of |
|
|
130 modules in the board: |
|
|
131 |
|
|
132 Boot: rommodules |
|
|
133 |
|
|
134 You should see the following output: |
|
|
135 |
|
|
136 Header Base Limit |
|
|
137 04000004 04000000 040034a8 BootStrap 1.00 (14 Aug 1998) |
|
|
138 04003a74 04003800 04003bc0 Production Test 1.00 (13 Aug 1998) |
|
|
139 0400e4f4 04004000 0400e60f Angel 1.02 (12 MAY 1998) |
|
|
140 0401ac00 04018000 0401aed8 eCos 1.2 (26 Feb 1999) GDB stubs |
|
|
141 |
|
|
142 Now make the eCos/"GDB stubs" module be the default monitor: |
|
|
143 |
|
|
144 Boot: plugin eCos |
|
|
145 |
|
|
146 |
|
|
147 Running and debugging an application |
|
|
148 ------------------------------------ |
|
|
149 |
|
|
150 Configure eCos from scratch for the ARM AEB-1 platform, and build your |
|
|
151 application. Remember that the AEB-1 board only has 128K of RAM. |
|
|
152 |
|
|
153 Exit from the terminal emulator (you will not need it anymore for |
|
|
154 normal operations), and run gdb: |
|
|
155 |
|
|
156 $ arm-elf-gdb -nw executable |
|
|
157 (gdb) set remotebaud 38400 |
|
|
158 (gdb) target remote <YOUR SERIAL PORT> |
|
|
159 (gdb) load |
|
|
160 |
|
|
161 You can now run your program in the usual way under GDB'S control |
|
|
162 |
|
|
163 Notice that the GDB stub runs at 38400 baud. |
|
|
164 |
|
|
165 |
|
|
166 Building the GDB stubs |
|
|
167 ---------------------- |
|
|
168 |
|
|
169 We provide the GDB stubs image in the directory |
|
|
170 loaders/arm-aeb/gdb_module.img, but here are instructions on how to |
|
|
171 rebuild them if you should ever need to. |
|
|
172 |
|
|
173 1. Configure a minimal eCos system with all packages except 'infra' |
|
|
174 disabled. If you are doing manual configuration, you can do so |
|
|
175 with |
|
|
176 |
|
|
177 tcl /work2/ecc/ecc/pkgconf.tcl \ |
|
|
178 --target=arm --platform=aeb --startup=stubs \ |
|
|
179 --disable CYGPKG_KERNEL --disable CYGPKG_UITRON \ |
|
|
180 --disable CYGPKG_LIBC --disable CYGPKG_LIBM \ |
|
|
181 --disable CYGPKG_ERROR --disable CYGPKG_IO \ |
|
|
182 --disable CYGPKG_IO_SERIAL --disable CYGPKG_DEVICES_WALLCLOCK \ |
|
|
183 --disable CYGPKG_DEVICES_WATCHDOG |
|
|
184 |
|
|
185 and if you are using the Configuration Tool GUI, you can select the |
|
|
186 ARM AEB platform, with GDB stubs startup, and enable the HAL and |
|
|
187 INFRA packages and disable all other packages. |
|
|
188 |
|
|
189 2. Edit <hal/hal.h> to enable GDB: |
|
|
190 #define CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS |
|
|
191 #undef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT |
|
|
192 #undef CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT |
|
|
193 |
|
|
194 you can use the following patch: |
|
|
195 |
|
|
196 --- pkgconf/hal.h~ Wed Mar 10 13:08:58 1999 |
|
|
197 +++ pkgconf/hal.h Thu Mar 11 15:53:16 1999 |
|
|
198 @@ -356,9 +356,9 @@ |
|
|
199 |
|
|
200 }}CFG_DATA */ |
|
|
201 |
|
|
202 -#undef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS |
|
|
203 +#define CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS |
|
|
204 #undef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT |
|
|
205 -#define CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT |
|
|
206 +#undef CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT |
|
|
207 |
|
|
208 /* |
|
|
209 * NOTE: |
|
|
210 |
|
|
211 |
|
|
212 3. make misc |
|
|
213 |
|
|
214 The gdb_module.img file will be built in the directory |
|
|
215 hal/arm/aeb/current/misc |
|
|
216 |
|
|
217 |
|
|
218 Alternate way of loading the initial stubs |
|
|
219 ------------------------------------------ |
|
|
220 |
|
|
221 Using the AEB-1 module tool, install the GDB stubs from the provided |
|
|
222 ".UU" file. |
|
|
223 |
|
|
224 >>> This is an annotated 'terminal' session with the AEB-1 monitor: |
|
|
225 |
|
|
226 ARM Evaluation Board Boot Monitor 0.01 (19 APR 1998) |
|
|
227 Press ENTER within 2 seconds to stop autoboot |
|
|
228 Boot: help |
|
|
229 Module is BootStrap 1.00 (14 Aug 1998) |
|
|
230 |
|
|
231 Help is available on: |
|
|
232 Help Modules ROMModules UnPlug PlugIn |
|
|
233 Kill SetEnv UnSetEnv PrintEnv DownLoad |
|
|
234 Go GoS Boot PC FlashWrite |
|
|
235 FlashLoad FlashErase |
|
|
236 |
|
|
237 Boot: download c000 |
|
|
238 Ready to download. Use 'transmit' option on terminal emulator to download file. |
|
|
239 |
|
|
240 ... at this point, I told my terminal emulator (minicom) to download the ASCII file |
|
|
241 gdb_module.img.UU (probably needs a different name on Win/NT) |
|
|
242 I had to enter ^D when the download was complete to get the monitor to come back. |
|
|
243 |
|
|
244 Loaded file gdb_module.img.raw at address 0000c000, size = 13905 |
|
|
245 |
|
|
246 Boot: flashwrite 4018000 c000 4000 |
|
|
247 |
|
|
248 As above, this command actually programs the FLASH. |
|
|
249 |
|
|
250 Boot: rommodules |
|
|
251 Header Base Limit |
|
|
252 04000004 04000000 040034a8 BootStrap 1.00 (14 Aug 1998) |
|
|
253 04003a74 04003800 04003bc0 Production Test 1.00 (13 Aug 1998) |
|
|
254 0400e4f4 04004000 0400e60f Angel 1.02 (12 MAY 1998) |
|
|
255 0401b608 04018000 0401b844 eCos 1.2 (26 Feb 1999) GDB stubs |
|
|
256 |
|
|
257 This verifies that the eCos GDB stubs are available in FLASH. |
|
|
258 |
|
|
259 Boot: plugin ecos |
|
|
260 |
|
|
261 This makes the eCos GDB stubs the default "monitor." When reset the |
|
|
262 AEB-1 will start the GDB stubs, after the initial 2 second escape |
|
|
263 period. |