OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or_debug_proxy/] [README] - Blame information for rev 497

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 julius
===============================================================================
2
-- OpenRISC Debug Proxy --
3
===============================================================================
4
 
5
===============================================================================
6
-- Description --
7
===============================================================================
8
A console application implementing a GDB stub and and communication with an
9
OpenRISC processor system via a USB debug cable.
10
===============================================================================
11
-- Versions --
12
===============================================================================
13
0.1.0 090201 jb@orsoc.se
14
0.1.1 090304 jb@orsoc.se
15
0.1.2 090511 jb@orsoc.se
16
0.1.3 090604 jb@orsoc.se
17 46 julius
0.1.4 090828 jb@orsoc.se
18 47 julius
0.1.5 090903 jb@orsoc.se
19 497 julius
0.1.6 110307 jb@orsoc.se
20 39 julius
===============================================================================
21
-- Installation --
22
===============================================================================
23
 
24
The OR debug proxy application runs on multiple platforms only requiring
25
slightly different driver configurations on each. Currently, Cygwin Windows,
26
several Linux distros and Mac OS X (10.4 and above) are supported.
27
Use with the ORSoC debug cable requires installation of some form of the FTDI
28
Chip FTD2XX driver. Instructions for each platform follow.
29
 
30
-------------------------------------------------------------------------------
31
-- Installation on Cygwin Windows --
32
-------------------------------------------------------------------------------
33
 
34
-- Compilation of the OpenRISC Debug Proxy application --
35
 
36
   While in the same directory which this file is located in, run a simple
37
   "make" command.
38
 
39
       user@cygwin-host ~/or_debug_proxy
40
       $ make
41
 
42
   Run the resulting executable (or_debug_proxy.exe) for usage details.
43
 
44
 
45
-- ORSoC OpenRISC USB debug cable driver installation --
46
 
47
  As per the installation instructions included in FTDI Chip's D2XX Windows
48
  driver.  http://www.ftdichip.com/Drivers/D2XX.htm
49
 
50
-------------------------------------------------------------------------------
51
-- Installation on Linux
52
-------------------------------------------------------------------------------
53
 
54
-- Compilation of the OpenRISC Debug Proxy application --
55
 
56
   There are two options for compilation. One results in a dynamically linked
57
   executable, the other links against a static library. See details on
58
   installing the desired library in the following section.
59
 
60
   -- Dynamically linked executable --
61
 
62
   This is the default build method. In the same directory this README is
63
   located, run a simple "make" command:
64
 
65
       user@host:~/or_debug_proxy$ make
66
 
67
   Ensure the driver library is installed before attempting to build, else it
68
   will fail.
69
 
70
   -- Static linked executable --
71
 
72
   To be able to use the proxy with the ORSoC USB debug cable without requiring
73
   installation of the driver libraries into system directories, a method of
74
   building and linking the proxy app to static libraries is provided. Ensure
75
   the static library for your platform is located in the lib/ directory
76
   underneath the path this README is located.
77
 
78
   To build, run:
79
 
80
      user@host:~/or_debug_proxy$ make static
81
 
82
 
83
-- ORSoC OpenRISC USB debug cable driver installation --
84
 
85
Before we begin:
86
 
87
It is required that the Linux distribution have a version 2.4 kernel, or
88
above. This is due to the USB driver libraries by FTDI Chip used to interface
89
with the USB debug device.
90
 
91
The ORSoC USB debugger cable uses a FTDI dual UART/FIFO chip.
92
 
93
An aside: These USB to serial devices typically trigger the loading of another
94
FTDI driver when they're attached to the system. This is the ftdi_sio driver
95
and now comes standard in newer kernels. This is of use to us, as one of the
96
two serial devices will remain is a standard UART under /dev/ttyUSBx. However,
97
to enable a high-speed JTAG interface with our hardware we require newer,
98
specialised drivers from FTDI called the D2XX drivers.
99
 
100
The Linux driver can be obtained from FTDI Chip's website,
101
http://www.ftdichip.com, and is found under the links to "Drivers" and then
102
"D2XX". At the time of writing, the latest version was libftd2xx 0.4.16 and
103
could be downloaded directly off their site from
104
http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx0.4.16.tar.gz
105
 
106
Statically linked driver:
107
 
108
The simplest way to enable these drivers is to link the application
109
statically - that is, have a copy of the driver along with the debugging
110
application. This is much simpler than the following driver installation
111
instructions. Typically in the FTDI drivers there is also a directory called
112
static_lib/ and this contains a driver that can be statically linked against
113
when compiling. To compile the OpenRISC debug proxy like this, copy the file in
114
that static_lib/ path into the lib/ directory under the or_debug_proxy/
115
build directory, and do:
116
 
117
      user@host:~/or_debug_proxy$ make static
118
 
119
This will result in the executable being statically linked to the driver file
120
in the the lib/ folder.
121
 
122
Dynamically linked driver install directions:
123
 
124
Uncompress the driver package (tar xzvf libftd2xx0.4.16.tar.gz) and read the
125
file "readme.dat" located inside, but don't complete their way of installing
126
yet. Their installation method should be modified slightly to allow easier use
127
of the USB device by users. Read the following before performing the install
128
as per the instructions in "readme.dat", and amend their installation process
129
as you go.
130
 
131
* In step 4, create an additional symbolic link, however this time with only a
132
  trailing zero, like so:
133
 
134
  user@host:/usr/local/lib$ ln -s libftd2xx.so.x.x.xx libftd2xx.so.0
135
 
136
* Again, in step 6, create an additional symbolic link with only a trailing
137
  zero:
138
 
139
  user@host:/usr/lib$ ln -s /usr/local/lib/libftd2xx.so.x.x.xx libftd2xx.so.0
140
 
141
* In step 7 (the following may vary depending on your distribution, however in
142
  the most recent Ubuntu our suggested modification was required) instead of
143
  the line provided in "readme.dat", use the following in your /etc/fstab file
144
  (note the difference is a change from "usbdevfs" to "usbfs")
145
 
146
     none /proc/bus/usb usbfs defaults,devmode=0666 0 0
147
 
148
* The last step (mount -a) outlined in "readme.dat" can then be performed.
149
 
150
-- Setting USB device permissions --
151
 
152
Depending on the Linux distribution and how recent it is, the method for
153
defining the permissions of the USB device when it's loaded by the kernel can
154
vary.
155
 
156
* Recent udev systems (most 2.6 kernel systems)
157
 
158
There can be variations in the way udev organises its files for setting up
159
rules and permissions of devices attached to the system, but the following
160
should cover most systems.
161
 
162
Do a listing of the udev rules directory
163
 
164
        user@host:~$ ls /etc/udev/rules.d/
165
 
166
There should be a file somewhere, with the word "permissions" in the name. On
167
some systems it could be called "40-permissions.rules", on others possibly
168
"020_permissions.rules". Locate the permissions file in /etc/udev/rules.d/
169
and, as the super user (root), open the file to edit. The author prefers nano.
170
 
171
      user@host:/etc/udev/rules.d$ sudo nano 40-permissions.rules
172
      [sudo] password for user:
173
 
174
Of course, editing as super user (sudo'ing) will require the ability to sudo.
175
 
176
The following can differ from system to system. In this case, a recent version
177
of Ubuntu, the file "40-permissions.rules" was present and will be edited.
178
 
179
In this particular permissions file there are different sections, some with
180
labels.
181
 
182
Search for the lines with LABEL="usb_serial_start" and
183
LABEL="usb_serial_end". In BETWEEN these two LABEL lines, insert two new lines
184
containing the following:
185
 
186
  # Permissions for ORSoC USB debugger FT2232 device
187
  ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666", GROUP="tty"
188
 
189
If these LABEL="" lines cannot be found (for instance, different distros have
190
their udev setup differently) insert the above line anywhere in the file. This
191
is not a definite way of enabling these permissions, and udev exists in many
192
forms and configurations, so if this does not work, please contact the author
193
regarding the issue.
194
 
195
* Fedora 9
196
 
197
As an example of a slightly different system, Fedora 9 does not have a
198
xx-permissions.rules file. The solution is to create a new file, but in this
199
case choose the name "51-permissions.rules". It can have just the rule listed
200
above:
201
 
202
  # Permissions for ORSoC USB debugger FT2232 device
203
  ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666", GROUP="tty"
204
 
205
The reason for the filename change is that the udev rules files are read in
206
lexical order (i.e. the order they would appear in a dictionary). With Fedora
207
9 the old FTDI driver is included as standard, and there is default rule in
208
50-udev-default.rules, which would override anything in 40-permissions.rules
209
(since it would be read first). By using the name 51-permissions.rules, our
210
rule will override anything set in 50-udev-default.rules.
211
 
212
If you find problems with permissions, then check that no later rules files
213
are overriding settings.
214
 
215
The devices whose permissions are set are /dev/ttyUSB0 /dev/ttyUSB1, the
216
/dev/usbdevnnn for the USB slot (nnn) being used, and the files in
217
/dev/bus/usb/nnn/xxx. They should all be in group tty and have permission
218
rw-rw-rw.
219
 
220
* Older systems, (early udev, devfs)
221
 
222
None of these systems were tested, however it should be easy enough to locate
223
the device by the vendor ID and product ID on the USB bus. See the Udev
224
instructions above for these values.
225
 
226
* Reloading the ftdi_sio driver
227
 
228
If it is desired that the D2XX drivers be unloaded and the original ftdi_sio one
229
reactivated (recreating the two /dev/ttyUSB devices), it is as simple as
230
removing and replacing the USB dongle from the system. However, it can also be
231
done at the prompt by first running as root "modprobe -r ftdi_sio", and then
232
"modprobe ftdi_sio vendor=0x0403 product=0x6010", which totally removes and
233
then reloads the device.
234
 
235
-- Usage OpenRISC Debug Proxy application --
236
 
237
   The proxy application can then be run with the desired options, or for
238
   usage details, run the program with no options specified.
239
 
240
       user@host:~/or_debug_proxy$ ./or_debug_proxy
241 497 julius
       Usage: or_debug_proxy   
242
       OpenRISC GDB Proxy Server
243 39 julius
 
244 497 julius
        Server Type:
245
        -r      Start a server using RSP, connection to hadware target via
246
                USB
247
        -j      Start a server using legacy OR remote JTAG protocol, to
248
                hardware target via USB (DEPRECATED)
249 39 julius
 
250 497 julius
        Port:
251
                Any free port within the usable range of 0 - 65535
252 39 julius
 
253 497 julius
        Options:
254
        -k      Accesses to 0xC0000000 map to 0x0. Useful for kernel debugging.
255 39 julius
 
256
        Example:
257 497 julius
                Start a GDB server on port 50001, using RSP, connecting to
258
                hardware target via USB:
259 39 julius
 
260 497 julius
                ./or_debug_proxy -r 50001
261 39 julius
 
262
* Platforms tested, and known to be working, on:
263 497 julius
  Ubuntu 8.04, 9.10, 10.10
264 39 julius
  Debian
265
 
266
-------------------------------------------------------------------------------
267
-- Installation on Mac OS X --
268
-------------------------------------------------------------------------------
269
 
270
-- ORSoC OpenRISC USB debug cable driver installation --
271
 
272
  As per the installation instructions included in FTDI Chip's D2XX Mac OS X
273
  driver.  http://www.ftdichip.com/Drivers/D2XX.htm
274
 
275
-- Compilation of the OpenRISC Debug Proxy application --
276
 
277
   As per the Linux instructions.
278
 
279
 
280
* Note: Tested on an Intel Mac, running OS X version 10.4
281
 
282
 
283
 
284
===============================================================================
285
-- Usage notes --
286
===============================================================================
287
 
288
When the program initialises it sets up some form of communication with an
289
OpenRISC processor (developed and tested with a OR1k design similar to the
290
ORPSoC design found in the OR1k project archive on OpenCores), either via a
291
USB debug cable or via sockets interface to an RTL simulation. After this, it
292
waits for a connection from GDB, and then the debugging session can begin.
293
 
294
The proxy has been written to be robust, for example it will hopefully handle
295
disruptions like processor crashes, hardware resets, and connection dropouts
296
gracefully enough to not require a complete restart of the proxy and GDB.
297
 
298
Some basic mechanics of the proxy are as follows:
299
 
300
* When the program is "continued" from GDB, the proxy will poll the processors
301
  stall indicator. If it detects the processor is stalled it will check against
302
  a list of software breakpoints to determine if this was the reason for the
303
  halt, otherwise it returns a signal depending on what it thinks the problem
304
  is.
305
 
306
* The there is alo polling for "interrupt" (^C signals) sent from GDB,
307
  which will cause the processor to be stalled, wherever it is, and control
308
  returned to GDB (the proxy will await further commands from GDB.) It is
309
  optional to implement this awareness of the interrupt signal from GDB, but
310
  the developers have found this functionality extremely useful and thought
311
  others might too.
312
 
313
* Troubleshooting tip: If the proxy prints out the following line(s):
314
                  RSP step with signal 'S04' received
315
  when attempting to continue, or single step, a program from GDB, it is
316
  necessary to restart both the proxy and GDB before being continuing.
317
  This bug is perhaps caused by changing the file GDB is debugging during the
318
  same session.
319
 
320
TODO List:
321
     * USB<->JTAG Driver TODO:
322
       Get the latest version of the MPSSE function code (from
323
       http://ftdichip.com/Projects/MPSSE/FTCJTAG/FTCJTAG_Source.zip at last
324
       check) and update our Linux compatible version with the ones here. This
325
       might provide improved stability or performance, but from the list of
326
       improvements made to the files from our version it doesn't appear like
327
       it would result in significant improvement in the proxy app.
328
     * Better README
329
       It would be nice to provide more important documentation of nuances of
330
       the proxy operation

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.