Please note that User Registration has been temporarily disabled due to a recent increase in automated registrations. If anyone needs an account, please request one here: RequestAccount. Thanks for your patience!--Wmat (talk)
Please email User:Wmat if you experience any issues with the Request Account form.

Flyswatter2 BeagleBone How To

From eLinux.org
Jump to: navigation, search

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


Connecting the Flyswatter2 and the BeagleBone

Requirements

To hook up the Flyswatter2 and the BeagleBone, you will need:

Connect the 20 Pin Ribbon Cable to the Flyswatter2.

Fs2 20pin ribbon.jpg
Connect one end of the 20-pin end ribbon cable to the Flyswatter2's JTAG interface.


Connect the 20-pin Ribbon Cable to the ARM20CTI20 Adapter Board.

Fs2 bone ribbon adapter.jpg
Connect the other end of the 20 pin ribbon cable into the ARM20CTI20 adapter. Your cable most likely has a raised nub on the head to force it into the correct position which matches a notch on the adapter. If it doesn't, align Pin 1 on the ribbon cable (marked with a red stripe) with the pin marked as 1 on the adapter.


Connect the 20-pin ARM20CTI20 adapter to to BeagleBone.

Fs2 bone adapter.jpg
Next, connect the ARM20CTI20 adapter connected to the ribbon cable to the 20 pin connector that has been added to the underside of the BeagleBone.


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.


Template:FLYSWATTER2 BEAGLEBONE COMPILEOCD


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 Template:BEAGLEBONE CFGRELPATH

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 Template:BEAGLEBONE CFGRELPATH

Template:BEAGLEBONE RUNOCDBRIEF

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 Template:BEAGLEBONE DEVICENAME. The output of the Reset command should look like this:

Template:BEAGLEBONE IMG OCDRESET

halt

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

Template:BEAGLEBONE IMG OCDHALT

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 Template:BEAGLEBONE DEVICENAME 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 Template:BEAGLEBONE DEVICENAME's registers.

Template:BEAGLEBONE IMG OCDREG

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.

Template:BEAGLEBONE IMG OCDREG0

If you run reg while the Template:BEAGLEBONE DEVICENAME 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:

Template:BEAGLEBONE IMG OCDREGNOTHALTED


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 Template:BEAGLEBONE DEVICENAME 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.

Template:BEAGLEBONE IMG OCDREGSET


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.