URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [or_debug_proxy/] [README] - Rev 790
Go to most recent revision | Compare with Previous | Blame | View Log
===============================================================================-- OpenRISC Debug Proxy --==============================================================================================================================================================-- Description --===============================================================================A console application implementing a GDB stub and and communication with anOpenRISC processor system via the OpenCores USB debug cable.===============================================================================-- Versions --===============================================================================0.1.0 090201 jb@orsoc.se0.1.1 090304 jb@orsoc.se0.1.2 090511 jb@orsoc.se0.1.3 090604 jb@orsoc.se0.1.4 090828 jb@orsoc.se0.1.5 090903 jb@orsoc.se0.1.6 110307 jb@orsoc.se0.1.7 110308 jb@orsoc.se0.1.8 110422 jb@orsoc.se===============================================================================-- Installation --===============================================================================The OR debug proxy application runs on multiple platforms only requiringslightly different driver configurations on each. Currently, Cygwin Windows,several Linux distros and Mac OS X (10.4 and above) are supported.Use with the ORSoC debug cable requires installation of some form of the FTDIChip FTD2XX driver. Instructions for each platform follow.--------------------------------------------------------------------------------- Installation on Cygwin Windows ----------------------------------------------------------------------------------- Compilation of the OpenRISC Debug Proxy application --While in the same directory which this file is located in, run a simple"make" command.user@cygwin-host ~/or_debug_proxy$ makeRun the resulting executable (or_debug_proxy.exe) for usage details.-- ORSoC OpenRISC USB debug cable driver installation --As per the installation instructions included in FTDI Chip's D2XX Windowsdriver. http://www.ftdichip.com/Drivers/D2XX.htm--------------------------------------------------------------------------------- Installation on Linux--------------------------------------------------------------------------------- Compilation of the OpenRISC Debug Proxy application --There are two options for compilation. One results in a dynamically linkedexecutable, the other links against a static library. See details oninstalling the desired library in the following section.-- Dynamically linked executable --This is the default build method. In the same directory this README islocated, run a simple "make" command:user@host:~/or_debug_proxy$ makeEnsure the driver library is installed before attempting to build, else itwill fail.-- Static linked executable --To be able to use the proxy with the ORSoC USB debug cable without requiringinstallation of the driver libraries into system directories, a method ofbuilding and linking the proxy app to static libraries is provided. Ensurethe static library for your platform is located in the lib/ directoryunderneath the path this README is located.To build, run:user@host:~/or_debug_proxy$ make static-- ORSoC OpenRISC USB debug cable driver installation --Before we begin:It is required that the Linux distribution have a version 2.4 kernel, orabove. This is due to the USB driver libraries by FTDI Chip used to interfacewith the USB debug device.The ORSoC USB debugger cable uses a FTDI dual UART/FIFO chip.An aside: These USB to serial devices typically trigger the loading of anotherFTDI driver when they're attached to the system. This is the ftdi_sio driverand now comes standard in newer kernels. This is of use to us, as one of thetwo serial devices will remain is a standard UART under /dev/ttyUSBx. However,to enable a high-speed JTAG interface with our hardware we require newer,specialised drivers from FTDI called the D2XX drivers.The Linux driver can be obtained from FTDI Chip's website,http://www.ftdichip.com, and is found under the links to "Drivers" and then"D2XX".WARNING: Later versions of the ftd2xx library appear not to work in the same wayas the earlier versions. Version 1.0.4 does not open the USB device unless thekernel module ftdi_sio is unloaded (sudo rmmod ftdi_sio), however unloading thismodule removes device nodes /dev/ttyUSB0 and /dev/ttyUSB1. These laterlibraries can be used with or_debug_proxy but the because the ftdi_sio kernelmodule must be unloaded first the serial consoles disappear. With this in mindit is probably better to use the older driver that does not require this kernelmodule be unloaded.FTDI Chip do not make older versions of their drivers available on their websitebut there are locations where version the static 0.4.16 library can be obtained.See the discussion at the following URL for a link to the older static library- http://opencores.org/forum,OpenRISC,0,4170 - which must be downloaded andplaced in the or_debug_proxy/lib path and a static compile performed, asoutline below.Statically linked driver:The simplest way to enable these drivers is to link the applicationstatically - that is, have a copy of the driver along with the debuggingapplication. This is much simpler than the following driver installationinstructions. Typically in the FTDI drivers there is also a directory calledstatic_lib/ and this contains a driver that can be statically linked againstwhen compiling. To compile the OpenRISC debug proxy like this, copy the file inthat static_lib/ path into the lib/ directory under the or_debug_proxy/build directory, and do:user@host:~/or_debug_proxy$ make staticThis will result in the executable being statically linked to the driver filein the the lib/ folder.Dynamically linked driver install directions:Uncompress the driver package (tar xzvf libftd2xxX.Y.Z.tar.gz) and read thefile "readme.dat" located inside, but don't complete their way of installingyet. Their installation method should be modified slightly to allow easier useof the USB device by users. Read the following before performing the installas per the instructions in "readme.dat", and amend their installation processas you go.* In step 4, create an additional symbolic link, however this time with only atrailing zero, like so:user@host:/usr/local/lib$ ln -s libftd2xx.so.x.x.xx libftd2xx.so.0* Again, in step 6, create an additional symbolic link with only a trailingzero:user@host:/usr/lib$ ln -s /usr/local/lib/libftd2xx.so.x.x.xx libftd2xx.so.0* In step 7 (the following may vary depending on your distribution, however inthe most recent Ubuntu our suggested modification was required) instead ofthe line provided in "readme.dat", use the following in your /etc/fstab file(note the difference is a change from "usbdevfs" to "usbfs")none /proc/bus/usb usbfs defaults,devmode=0666 0 0* The last step (mount -a) outlined in "readme.dat" can then be performed.-- Setting USB device permissions --Depending on the Linux distribution and how recent it is, the method fordefining the permissions of the USB device when it's loaded by the kernel canvary.* Recent udev systems (most 2.6 kernel systems)There can be variations in the way udev organises its files for setting uprules and permissions of devices attached to the system, but the followingshould cover most systems.Do a listing of the udev rules directoryuser@host:~$ ls /etc/udev/rules.d/There should be a file somewhere, with the word "permissions" in the name. Onsome systems it could be called "40-permissions.rules", on others possibly"020_permissions.rules". Locate the permissions file in /etc/udev/rules.d/and, as the super user (root), open the file to edit. The author prefers nano.user@host:/etc/udev/rules.d$ sudo nano 40-permissions.rules[sudo] password for user:Of course, editing as super user (sudo'ing) will require the ability to sudo.The following can differ from system to system. In this case, a recent versionof Ubuntu, the file "40-permissions.rules" was present and will be edited.In this particular permissions file there are different sections, some withlabels.Search for the lines with LABEL="usb_serial_start" andLABEL="usb_serial_end". In BETWEEN these two LABEL lines, insert two new linescontaining the following:# Permissions for ORSoC USB debugger FT2232 deviceATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666", GROUP="tty"If these LABEL="" lines cannot be found (for instance, different distros havetheir udev setup differently) insert the above line anywhere in the file. Thisis not a definite way of enabling these permissions, and udev exists in manyforms and configurations, so if this does not work, please contact the authorregarding the issue.* Fedora 9As an example of a slightly different system, Fedora 9 does not have axx-permissions.rules file. The solution is to create a new file, but in thiscase choose the name "51-permissions.rules". It can have just the rule listedabove:# Permissions for ORSoC USB debugger FT2232 deviceATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666", GROUP="tty"The reason for the filename change is that the udev rules files are read inlexical order (i.e. the order they would appear in a dictionary). With Fedora9 the old FTDI driver is included as standard, and there is default rule in50-udev-default.rules, which would override anything in 40-permissions.rules(since it would be read first). By using the name 51-permissions.rules, ourrule will override anything set in 50-udev-default.rules.If you find problems with permissions, then check that no later rules filesare overriding settings.The devices whose permissions are set are /dev/ttyUSB0 /dev/ttyUSB1, the/dev/usbdevnnn for the USB slot (nnn) being used, and the files in/dev/bus/usb/nnn/xxx. They should all be in group tty and have permissionrw-rw-rw.* Older systems, (early udev, devfs)None of these systems were tested, however it should be easy enough to locatethe device by the vendor ID and product ID on the USB bus. See the Udevinstructions above for these values.* Reloading the ftdi_sio driverIf it is desired that the D2XX drivers be unloaded and the original ftdi_sio onereactivated (recreating the two /dev/ttyUSB devices), it is as simple asremoving and replacing the USB dongle from the system. However, it can also bedone at the prompt by first running as root "modprobe -r ftdi_sio", and then"modprobe ftdi_sio vendor=0x0403 product=0x6010", which totally removes andthen reloads the device.-- Usage OpenRISC Debug Proxy application --The proxy application can then be run with the desired options, or forusage details, run the program with no options specified.user@host:~/or_debug_proxy$ ./or_debug_proxyUsage: or_debug_proxy <SERVERTYPE> <PORT> <OPTIONS>OpenRISC GDB Proxy ServerServer Type:-r Start a server using RSP, connection to hadware target viaUSB-j Start a server using legacy OR remote JTAG protocol, tohardware target via USB (DEPRECATED)Port:Any free port within the usable range of 0 - 65535Options:-k Accesses to 0xC0000000 map to 0x0. Useful for kernel debugging.Example:Start a GDB server on port 50001, using RSP, connecting tohardware target via USB:./or_debug_proxy -r 50001* Platforms tested, and known to be working, on:Ubuntu 8.04, 9.10, 10.10Debian--------------------------------------------------------------------------------- Installation on Mac OS X ----------------------------------------------------------------------------------- ORSoC OpenRISC USB debug cable driver installation --As per the installation instructions included in FTDI Chip's D2XX Mac OS Xdriver. http://www.ftdichip.com/Drivers/D2XX.htm-- Compilation of the OpenRISC Debug Proxy application --As per the Linux instructions.* Note: Tested on an Intel Mac, running OS X version 10.4===============================================================================-- Usage notes --===============================================================================When the program initialises it sets up some form of communication with anOpenRISC processor (developed and tested with a OR1k design similar to theORPSoC design found in the OR1k project archive on OpenCores), either via aUSB debug cable or via sockets interface to an RTL simulation. After this, itwaits for a connection from GDB, and then the debugging session can begin.The proxy has been written to be robust, for example it will hopefully handledisruptions like processor crashes, hardware resets, and connection dropoutsgracefully enough to not require a complete restart of the proxy and GDB.Some basic mechanics of the proxy are as follows:* When the program is "continued" from GDB, the proxy will poll the processorsstall indicator. If it detects the processor is stalled it will check againsta list of software breakpoints to determine if this was the reason for thehalt, otherwise it returns a signal depending on what it thinks the problemis.* The there is alo polling for "interrupt" (^C signals) sent from GDB,which will cause the processor to be stalled, wherever it is, and controlreturned to GDB (the proxy will await further commands from GDB.) It isoptional to implement this awareness of the interrupt signal from GDB, butthe developers have found this functionality extremely useful and thoughtothers might too.* Troubleshooting tip: If the proxy prints out the following line(s):RSP step with signal 'S04' receivedwhen attempting to continue, or single step, a program from GDB, it isnecessary to restart both the proxy and GDB before being continuing.This bug is perhaps caused by changing the file GDB is debugging during thesame session.TODO List:* USB<->JTAG Driver TODO:Get the latest version of the MPSSE function code (fromhttp://ftdichip.com/Projects/MPSSE/FTCJTAG/FTCJTAG_Source.zip at lastcheck) and update our Linux compatible version with the ones here. Thismight provide improved stability or performance, but from the list ofimprovements made to the files from our version it doesn't appear likeit would result in significant improvement in the proxy app.* Better READMEIt would be nice to provide more important documentation of nuances ofthe proxy operation
Go to most recent revision | Compare with Previous | Blame | View Log
