| Open JTAG debugging tool for the PXA270 |
|
Looking for a low cost, high functionality JTAG solution for the PXA270? As of several weeks ago, the openocd project now works with the Intel/Marvell PXA270 processor. There are a number of USB based JTAG debuggers available for under $100, so the cost is minimal. This article provides a brief overview of JTAG, suggestions for your hardware design, and how to use OpenOCD (Open On-chip-debugger) with the PXA270. OpenOCDOver the past 8 years, I've used a number of JTAG solutions for programming and debugging embedded processor systems. At the low end, there are JTAG solutions for flash programming only that just wiggle pins on a PC parallel port which in turn wiggle pins on the scan chain of the processor. This way of doing things works, but is very slow because you have to fabricate the bus cycles in software and clock the entire jtag chain just to change the state of one pin. The jtag tools from the openwince project on Sourceforge fall into this category. More advanced JTAG tools use the debugging capability of a processor to speed up flash programming and add debugging features. This typically involves downloading a tiny bit of code into the cache or internal SRAM in the CPU. This bit of code then can receive blocks of data or instructions and run bus cycles directly through the memory controller in the device. This makes flash programming very fast as most of the work is being done by the CPU, instead of manually controlling CPU pins using a jtag chain. In past years, there have been various attempts at creating an open source JTAG solution, but none of them have gotten very far. When I had a project that needed to get done quickly, I simply bought or upgraded a BDI2000 debugger -- which is an excellent tool. The OpenOCD project now provides much of the same functionality as a BDI2000, but as in the case of the PXA270, it sometimes takes some work to get it all working. OpenOCD was created by Dominic Rath as part of a diploma thesis (http://openocd.berlios.de/web/). It provides support for a wide range of target processors and JTAG debuggers. OpenOCD includes functionality for On-Chip Debugging, In-System Programming, and Boundary-Scan Testing. Hardware design considerationsAlthough openocd has worked with other Xscale parts for some time, functionality for the PXA270 has not worked until recently. The primary reason for this is the way the power supplies are sequenced in most PXA270 designs. There is one supply to the PXA270 that is always on (VCC_BATT). All of the other supplies are often kept off until reset to the processor is de-asserted and the SYS_EN and PWR_EN signals go active. Because of this, some special considerations need to be taken during the sequencing of the reset signals, and the setting of the hold_rst bit in the PXA270 DCSR register. Make sure you power the JTAG connection (Pin #1 of your JTAG connector) with VCC_BATT or some power that is always active. If you power the JTAG connector with a power supply that is controlled by the SYS_EN or PWR_EN signal, then you will loose JTAG power during the connection process and things obviously will not work. JTAG Debugger HardwareMost of the JTAG debugger debuggers used with OpenOCD are based on the FTDI FT2232 USB chip. The debugger I used is the arm-usb-ocd device from Olimex. At a cost of $80, you can't afford not to have one. OpenOCD InstallationOpenOCD can use two different libraries that provide access to the FTDI chip: an open source library named libftdi, and a closed source library from FTDI named libftd2xx. I could not get the opensource libftdi library to work, so I suggest you use the FTDI library for now. Otherwise, installation is pretty straightforward. Find yourself a reasonably modern Linux computer and follow instructions on the following page: http://openfacts.berlios.de/index-en.phtml?title=Building_OpenOCD . Make sure you use the --enable-ft2232_ftd2xx option when running configure. On Ubuntu 7.04: Install the FTDI library:
Install OpenOCD:
OpenOCD ConfigurationOpenOCD is configured using a configuration file. An example is: # config for Intel PXA270 Programming FlashAfter OpenOCD is installed, copy the above config file contents to a file name openocd.cfg, and run openocd in the same directory as your configuration file. Currently, there is an issue in that the openocd is expecting a debug handler file at a specific relative path from the openocd binary. The easiest way to get around this for now is to to run openocd from the src directory in the openocd source code. If you get the following message: Error: ft2232.c:1338 ft2232_init_ftd2xx(): unable to open ftdi device: 2, there is a permissions problem with the USB device. To get around this, run openocd using sudo, or add the appropriate rules to udev to allow the usb device to be used by any user. OpenOCD runs as a daemon waiting for telnet or GDB connections. After openocd starts, you can connect to it by running the following command: telnet localhost 3333 At this point you should be presented with a OpenOCD prompt. The following is an example of how to program a bootloader into flash memory: > flash probe 0 DebuggingIn this example, OpenOCD waits for GDB connections on port 4444. To debug code running on the target, you would use gdb in the same way you would use a BDI2000, or most any other hardware debugger with GDB. SummaryOpenOCD is a robust, full-featured JTAG debug solution that supports many processors and low cost JTAG debuggers. There are still a few rough edges to clean up with PXA270 support, but OpenOCD is already a very useful tool for embedded software development.
| |||||||
|
|||||||
| Last Updated ( Tuesday, 10 July 2007 ) | |||||||