Difference between revisions of "BeagleBoardOpenOCD"
m (Update status link) |
m (Update config files and output) |
||
Line 105: | Line 105: | ||
#jtag scan chain | #jtag scan chain | ||
− | + | source [find target/omap3530.cfg] | |
− | source [find | + | |
+ | and a file '''omap3530.cfg''': | ||
+ | |||
+ | #File omap3530.cfg | ||
+ | #TI OMAP3530 processor - http://www.ti.com | ||
+ | |||
+ | if { [info exists CHIPNAME] } { | ||
+ | set _CHIPNAME $CHIPNAME | ||
+ | } else { | ||
+ | set _CHIPNAME omap3530 | ||
+ | } | ||
+ | |||
+ | if { [info exists ENDIAN] } { | ||
+ | set _ENDIAN $ENDIAN | ||
+ | } else { | ||
+ | # this defaults to a little endianness | ||
+ | set _ENDIAN little | ||
+ | } | ||
− | # | + | if { [info exists CPUTAPID ] } { |
− | + | set _CPUTAPID $CPUTAPID | |
+ | } else { | ||
+ | # force an error till we get a good number | ||
+ | set _CPUTAPID 0xffffffff | ||
+ | } | ||
− | + | #jtag scan chain | |
− | + | jtag newtap $_CHIPNAME jrc -irlen 6 -ircapture 0x1 -irmask 0xf -expected-id 0x0b7ae02f | |
− | + | jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0x0 -expected-id $_CPUTAPID -disable | |
− | + | ||
− | + | jtag configure $_CHIPNAME.cpu -event tap-enable { | |
− | + | puts "Enabling CPU" | |
− | + | irscan omap3530.jrc 7 | |
− | + | drscan omap3530.jrc 8 0x89 | |
− | + | irscan omap3530.jrc 2 | |
− | + | drscan omap3530.jrc 32 0x81000080 | |
− | + | drscan omap3530.jrc 32 0xa3002048 | |
− | + | drscan omap3530.jrc 32 0x81002148 | |
− | + | drscan omap3530.jrc 32 0xa3002148 | |
+ | runtest 10 | ||
+ | puts "Enabled CPU" | ||
} | } | ||
− | |||
− | Interface configuration file ''flyswatter.cfg'' is part of OpenOCD source | + | Interface configuration file ''flyswatter.cfg'' is part of OpenOCD source. |
Assuming you | Assuming you | ||
Line 140: | Line 162: | ||
> openocd -s lib/openocd/ | > openocd -s lib/openocd/ | ||
− | Open On-Chip Debugger 1.0 (2008-12- | + | |
+ | Open On-Chip Debugger 1.0 (2008-12-19-17:38) svn:1261 | ||
BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS | BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS | ||
Line 146: | Line 169: | ||
$URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $ | $URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $ | ||
jtag_speed: 1 | jtag_speed: 1 | ||
− | + | Info: JTAG tap: omap3530.jrc tap/device found: 0x0b7ae02f (Manufacturer: 0x017, Part: 0xb7ae, Version: 0x0) | |
− | + | Info: JTAG Tap/device matched | |
− | |||
− | |||
Warning:no gdb ports allocated as no target has been specified | Warning:no gdb ports allocated as no target has been specified | ||
Warning:no tcl port specified, using default port 6666 | Warning:no tcl port specified, using default port 6666 | ||
+ | |||
+ | This shows that your (Flyswatter) JTAG dongle basically works and that you are able to see OMAP3 JRC. | ||
tbd. | tbd. |
Revision as of 13:40, 19 December 2008
This page is about how to use open source OpenOCD JTAG software with BeagleBoard. With this, it will be possible to have OMAP3 JTAG debug using cheap JTAG hardware, e.g. Flyswatter.
As of December 2008, OpenOCD doesn't work with Beagle Board (ARM Cortex A8, OMAP3). OpenOCD support is work in progress. This section tries to cover the recent status to
- give everybody the steps to recent status in case they want to help
- be ready if support is ready
OpenOCD JTAG bring up
On IRC it was discussed what will be necessary to get OpenOCD working with OMAP3 on BeagleBoard:
- OpenOCD compatible JTAG hardware interface with FTDI's FT2232 chip, e.g. Flyswatter.
- Create an adapter to convert the Flyswatter 14-pins JTAG into 14-pins TI JTAG
- Get latest OpenOCD source
- Add Cortex-A8 CPU ID. Currently only Cortex-M3 is supported. Take this as example. Once you connect to target you should get error message expect cpuid of xxxxxx but got yyyyyy which should contain Cortex-A8 CPU ID.
- Take CPU scan lengths from OMAP3530 CCS config.
- Regarding EMU0/EMU1 pins on BeagleBoard, pulling both pins down does currently not make Cortex-A8 CPU accessible. Only one TAP is visible (ICEPick). Therefore OpenOCD will not be able to validate the scan chain. The documentation for the control of EMU0/EMU1 is very misleading:
0 0 ICEPick + default TAP(s) 0 1 ICEPick Reserved 1 0 ICEPick Wait-in-reset 1 1 ICEPick Default condition NOTES: ICEPick is always in the scan chain Default TAPs are the ARM and the ETB
This table is identical to the Davinci documentation, with one BIG difference:
- The OMAP3xx has NO default TAP (ARM or ETB taps) which means that the configuration of EMU0-L/EMU1-L doesn't add ARM to scan chain (above table is wrong, though).
The OMAP3xx uses a TAP router, it needs to be programmed with the information about available TAPS first, before ARM is accessible. Once the DAP has been added to the TAP router, via a programming sequence, the ARM core can be accessed.
TI has a good presentation describing the functionality of the ICEPick TAP Router (or generically refered to as JTAG Route Controller or JRC). The ICEPick jtag device ID is 0x0b73b02f (Manufacturer: 0x017, Part: 0xb73b, Version: 0x0) and is the same as the Davinci series.
It may still be possible to use the EMU0-L/EMU1-L configuration, but with consideration that the TAP router will already configured for with the arm core interface. Yet to be tested.
If above basics work, additionally MMU, cache support and some include files for A8 might be added to OpenOCD.
Note: If you made some progress regarding BeagleBoard OpenOCD support, please send a short note to BeagleBoard ML and OpenOCD ML.
Status December 2008:
- Status mail at OpenOCD mailing list.
- There is some discussion how to extend OpenOCD to support JRC configuration (see thread JTAG emulator with openocd for beagleboard).
Build OpenOCD
OpenOCD build instructions describe how to build OpenOCD. For questions you can use OpenOCD Mailing list.
Get OpenOCD code via svn:
> svn checkout svn://svn.berlios.de/openocd/trunk openocd
For Flyswatter you additionally need libftd2xx or libFTDI. While libFTDI is available in source, libftd2xx is supposed to be 50% faster than libFTDI, but only available as (binary) shared library.
If you downloaded OpenOCD svn and have libftd2xx or libFTDI, build OpenOCD (assuming you extracted/built FTDI library already):
> cd openocd > ./bootstrap > CFLAGS="-g -O2 -L<path_to>/libftd2xx0.4.15" ./configure --enable-ft2232_ftd2xx --with-ftd2xx=<path_to>/libftd2xx0.4.15 --prefix=/home/user/bin/openOCD or (depending which FTDI library you use, see above) > CFLAGS="-g -O2 -L<path_to_libftdi>" ./configure --enable-ft2232_libftdi -with-ftd2xx=<path_to>/include --prefix=/home/user/bin/openOCD > make > make install
Note: There is a bug in OpenOCD build tooling using -with-ftd2xx path if you didn't install libftd2xx/ibftdi library in standard path: While you give the path to (include/header) directory, the header file is found. But the path given with -with-ftd2xx isn't used while linking, so linking might fail not finding libftd2xx/libftdi. We fix this above by manually setting CFLAGS with adding library path with -L (additional to standard options -g -O2) at configure time.
Note: By default (make & make install) only .info documentation is installed. You can get PDF or HTML documentation by
make pdf
or
make html
Resulting documentation can be found in openocd/doc, then.
Note: If you like to save some disk space and don't plan to debug OpenOCD binary itself, you can strip this (remove unneeded debug symbols):
> cd <openocd_install_dir>/bin > strip openocd
(e.g. with OpenOCD 1.0 this reduced binary size from ~3MB to ~700kB)
Note: If you don't have libftdi in standard path, you might like to extend library search path:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path_to>/lib
if you e.g. get
> ./openocd ./openocd: error while loading shared libraries: libftdi.so.1: cannot open shared object file: No such file or directory
Beagle configuration file
OpenOCD runtime is controlled by several configuration files. I.e. main configuration file (openocd.cfg) calling ("source") various sub configurations. For Beagle, in directory where you start openocd create a file openocd.cfg (assuming you use Flyswatter):
#File openocd.cfg #Basic configuration telnet_port 4444 gdb_port 3333 #Interface source [find interface/flyswatter.cfg] #jtag scan chain source [find target/omap3530.cfg]
and a file omap3530.cfg:
#File omap3530.cfg #TI OMAP3530 processor - http://www.ti.com if { [info exists CHIPNAME] } { set _CHIPNAME $CHIPNAME } else { set _CHIPNAME omap3530 } if { [info exists ENDIAN] } { set _ENDIAN $ENDIAN } else { # this defaults to a little endianness set _ENDIAN little } if { [info exists CPUTAPID ] } { set _CPUTAPID $CPUTAPID } else { # force an error till we get a good number set _CPUTAPID 0xffffffff } #jtag scan chain jtag newtap $_CHIPNAME jrc -irlen 6 -ircapture 0x1 -irmask 0xf -expected-id 0x0b7ae02f jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0x0 -expected-id $_CPUTAPID -disable jtag configure $_CHIPNAME.cpu -event tap-enable { puts "Enabling CPU" irscan omap3530.jrc 7 drscan omap3530.jrc 8 0x89 irscan omap3530.jrc 2 drscan omap3530.jrc 32 0x81000080 drscan omap3530.jrc 32 0xa3002048 drscan omap3530.jrc 32 0x81002148 drscan omap3530.jrc 32 0xa3002148 runtest 10 puts "Enabled CPU" }
Interface configuration file flyswatter.cfg is part of OpenOCD source.
Assuming you
- have a beagleboard.cfg in board directory
- have Flyswatter switched on (attached to USB)
- have openocd.cfg in the directory you start openocd from
you can now start openocd with
openocd -s <path_to_config_files> // e.g. <patch_of_openocd_install_dir>/lib/openocd
This should result in
> openocd -s lib/openocd/ Open On-Chip Debugger 1.0 (2008-12-19-17:38) svn:1261 BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS $URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $ jtag_speed: 1 Info: JTAG tap: omap3530.jrc tap/device found: 0x0b7ae02f (Manufacturer: 0x017, Part: 0xb7ae, Version: 0x0) Info: JTAG Tap/device matched Warning:no gdb ports allocated as no target has been specified Warning:no tcl port specified, using default port 6666
This shows that your (Flyswatter) JTAG dongle basically works and that you are able to see OMAP3 JRC.
tbd.
GDB ARM
To debug an ARM target with GNU debugger (GDB), you need a GDB understanding ARM processor. If your ARM cross compilation tool chain doesn't include a GDB, you can easily build it your self.
- Download latest GDB sources. OpenOCD docu recommends to use GDB 6.7 or newer. Here, we use GDB 6.8 which is the recent version while writing this.
- Extract, configure and build GDB for ARM. Afterwards remove temporary stuff. Options are:
- <path_where_ARM_gdb_shall_be_installed_to> : Directory where you want to install the resulting tool to. E.g. /home/user/arm-gdb/
- <ARM_toolchain_prefix> : The prefix of your ARM GCC toolchain, e.g. arm-linux or arm-none-linux-gnueabi (CodeSourcery tool chain).
> tar xfj gdb-6.8.tar.bz2 > mkdir build-gdb > cd build-gdb/ build-gdb > ../gdb-6.8/configure --prefix=<path_where_ARM_gdb_shall_be_installed_to> --target=<ARM_toolchain_prefix> i686-pc-linux-gnu build-gdb > make -j4 build-gdb > make install build-gdb > cd .. > rm -rf gdb-6.8 build-gdb > export PATH=$PATH:<path_where_ARM_gdb_shall_be_installed_to>/bin
Test:
bin> ./arm-none-linux-gnueabi-gdb GNU gdb 6.8 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi". (gdb)