Difference between revisions of "Flyswatter2 Beagleboard XM How To"

From eLinux.org
Jump to: navigation, search
(Porting TinCanTools wiki content.)
 
(Adding proper categories)
 
Line 1: Line 1:
 
{{HowTo|FLYSWATTER2|BEAGLEXM}}
 
{{HowTo|FLYSWATTER2|BEAGLEXM}}
 +
 +
[[Category:TinCanTools]]
 +
[[Category:OpenOCD]]
 +
[[Category:BeagleBoard-XM]]

Latest revision as of 19:38, 17 April 2012

This guide will walk you through connecting the Flyswatter2 and the TI Beagleboard XM to your Linux PC, and installing and running OpenOCD. This guide was written with Ubuntu 10.04.


Connecting the Flyswatter2 and the Beagleboard XM

To hook up the Flyswatter2 and the Beagleboard XM, you will need:

  • 20-pin ARM to 14-pin TI JTAG Adapter Board
  • 14-pin JTAG Ribbon Cable
  • RS-232 Serial Cable with one male, one female head
  • USB Male A/Male B Cable
  • 5V1A Power Cable

Set the EMU pins on the JTAG Adapter Board.

Ti adapter.png

The EMU0 and EMU1 pins should be set to 1. Set both jumpers to the position closest to the 14-pin interface, as in the picture.


Connect the JTAG Adapter Board to the Flyswatter2.

Fs2 ti adapter.png

Connect the 20-pin end of the adapter board to the Flyswatter2's JTAG interface.


Connect the 14-pin Ribbon Cable to the JTAG Adapter Board.

Fs2 ti jtag.png

Your cable most likely has a notch on the head to force it into the correct position. If it doesn't, align Pin 1 on the ribbon cable with the side of the board opposite the EMU pins. (In the picture, Pin 1 is marked by the red stripe on the cable.)


Connect the 10-pin Ribbon Cable to the RS-232 Adapter Board.

Fs2 jtag14serial10.png

Connect the Other End of the Ribbon Cable to the Beagleboard XM.

Fs2 beaglexm jtag.png

Be sure to align the ribbon cable correctly. Pin 1 on the Beagleboard XM is the pin closest to the center of the board.


Plug in the Serial Cable.

Fs2 beaglexm bothcables.png

Connect the Flyswatter2 and the Beagleboard XM with the RS-232 serial cable.


Connect the USB cable to the Flyswatter2.

Fs2 beaglexm usb.png

Find the USB cable that comes with the Flyswatter2. Connect the B end (the square end, not the flat end) to the Flyswatter2.


Connect the Power Cable to the Beagleboard XM.

Fs2 beaglexm power.png

The Beagleboard XM's power adapter is next to the serial port.


Plug the Power Adapter into a Wall Outlet.

The green power LED on the Beagleboard XM should come on and remain on.

Plug the USB Cable into your PC.

The green power LED on the Flyswatter2 should come on and remain on.


Installing OpenOCD

OpenOCD (Open On-Chip Debugger) is open-source software that interfaces with the Flyswatter2. OpenOCD provides debugging and in-system programming for embedded target devices. You will need to compile OpenOCD from source, and patch the source with one of the OpenOCD Patches for Flyswatter 2 support.

Whichever guide you use, be sure to install the patch! Both guides include instructions on downloading and installing the patch.


Compiling OpenOCD Linux - This set of instructions uses libFTDI, an open-source driver library for FTDI devices.

Compiling OpenOCD Linux D2XX - This set of instructions uses FTDXX, a closed-source driver library from Future Technology Devices International.


Running OpenOCD

Now you are ready to run OpenOCD. If you installed the OpenOCD Ubuntu package, open a terminal window and type the following from any directory:

openocd -f interface/flyswatter2.cfg -f board/ti_beagleboard_xm.cfg -c init -c "reset init"

If you compiled OpenOCD yourself, navigate to the openocd-bin directory you created in the compile guide and type:

cd ~/openocd-bin
sudo ./openocd -f interface/flyswatter2.cfg -f board/ti_beagleboard_xm.cfg -c init -c "reset init"

For more information, see Running OpenOCD on Linux. When you start OpenOCD, its output should look like this:

Beaglexm ocdstartup.png

JTAG-DP_STICKY_ERROR on startup

You may see one or more JTAG-DP_STICKY_ERROR immediately on startup. This is caused by a bug in OpenOCD, but don't worry. OpenOCD will still be able to communicate with the board. The errors look like this.

Beaglexm ocderr.png

The -c init -c "reset init" commands at the end of the OpenOCD startup is a workaround for this error. If you don't include the init and reset init commands, you will still be able to use OpenOCD with the Beagleboard XM. However, if you exit and restart OpenOCD, it will fail to connect unless you unplug the Flyswatter and plug it back in.

Telnet Connection

You cannot enter commands directly to OpenOCD. Open a new terminal window and type:

telnet localhost 4444

You will should see this prompt:

Telnet.png

You can give commands to OpenOCD through this prompt.


Common OpenOCD Commands

To see a full list of OpenOCD commands, enter help in the telnet window.

reset

Resets the Beagleboard XM. The output of the Reset command should look like this:

Beaglexm reset.png

halt

Sends a halt request to the Beagleboard XM. If the Beagleboard XM halts, you will see text output in the telnet window. (If the Beagleboard XM is already halted, you will see no output.)

Beaglexm halt.png

halt [timeout]

You can also use halt followed by a time in milliseconds. OpenOCD waits for the target to halt the specified amount of time, then gives up if the target has not halted. You can use this to avoid OpenOCD hanging because the Beagleboard XM fails to halt. For example, to send a halt command with a timeout of one second, type:

halt 1000

resume

Enter resume to end a halt. You will not see any text output in the telnet window.

reg

Displays a numbered list of all of the Beagleboard XM's registers.

Beaglexm reg.png

reg [entry]

Run reg with a register number to display the contents of a register, in hexadecimal. The register number corresponds to the output of the reg command with no arguments, above. You must run the halt command before reading registers.

Beaglexm reg0.png

If you run reg while the Beagleboard XM is not halted, you will still see the value stored in the register. However, registers change contents very quickly while the device is running; by the time you see the value, the value actually in the register may be different. If you try to run reg while the device is not halted, you will see this:

Beaglexm reg0 nothalted.png


reg [entry] [value]

Sets the value of a register. The register number corresponds to the output of the reg command with no arguments, above. Make sure the Beagleboard XM is halted (with the halt command) before you change the value of a register!

You can enter registry values in either decimal, by typing a number by itself, or in hexadecimal, by prefacing the value with 0x.

Beaglexm regset.png


GDB Debugger

GDB, the GNU Project Debugger is a debugging tool provided with the GNU Compiler Collection (GCC). GDB allows you to stop and start a running program, examine its functioning, and make changes. GDB is installed on Ubuntu 10.04 by default, but you will need a different version of GDB build for embedded targets. Follow the instructions on the GDB Debugger page below.

GDB Debugger

The GDB debugger page will walk you through installing GDB for use with OpenOCD, and loading and testing a simple program.