This tutorial was tested on i.MX27ADS REV. 2.6 and may not work on other board revision.
The libFTDI is necessary when using JTAG based on FT2232 or others FTDI chips.
LibFTDI need libusb, then install it first:
$ sudo apt-get install libusb-dev
Download libftdi from http://www.intra2net.com/en/developer/libftdi:
$ wget http://www.intra2net.com/en/developer/libftdi/download/libftdi-0.18.tar.gz
Now decompress and install it:
$ tar zxvf libftdi-0.18.tar.gz $ ./configure $ make $ sudo make install
To compile OpenOCD you need to have GCC, Autoconf and automake installed.
Get the OpenOCD source code (we are using rev. 1083):
svn checkout http://svn.berlios.de/svnroot/repos/openocd/trunk openocd --revision 1399
Create the configure file and Makefile.in:
$ ./bootstrap
Run configure:
$ ./configure --enable-ft2232_libftdi
Compile:
$ make
Install it:
$ sudo make install
Connect your JTAG interface on computer and i.MX27ADS board.
Run OpenOCD passing as parameter the processor config and JTAG interface config:
$ sudo openocd -f interface/myinterface.cfg -f board/imx27ads.cfg
Replace myinterface.cfg by jtag interface you are using.
In our case we are using Signalyzer Jtag Interface:
$ sudo openocd -f interface/signalyzer.cfg -f board/imx27ads.cfg
Note: We need to add "jtag_speed 5" on signalyzer.cfg in order to it works on i.MX27ADS.
You will see this init message:
# openocd -f interface/signalyzer.cfg -f board/imx27ads.cfg Open On-Chip Debugger 1.0 (2009-03-06-08:47) svn:1399 BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS $URL: http://svn.berlios.de/svnroot/repos/openocd/trunk/src/openocd.c $ jtag_speed: 5 dcc downloads are enabled Info : JTAG tap: imx27.bs tap/device found: 0x1b900f0f (Manufacturer: 0x787, Part: 0xb900, Version: 0x1) Info : JTAG Tap/device matched Info : JTAG tap: imx27.cpu tap/device found: 0x07926121 (Manufacturer: 0x090, Part: 0x7926, Version: 0x0) Info : JTAG Tap/device matched Warn : no telnet port specified, using default port 4444 Warn : no gdb port specified, using default port 3333 Warn : no tcl port specified, using default port 6666
If you already have an arm-elf-gdb then skip this step, otherwise go on.
To create an arm GDB enter on LTIB -> Package List and select this:
[*] gdb [ ] gdb to run natively on the target [*] cross gdb (runs on build machine)
It will create the ARM GDB file at ~/ltib-dir/bin/gdb
$ cd /home/alan/ltib-imx27ads-20071219/bin
Copy this gdb binary to /usr/bin renaming it to arm-elf-gdb:
$ sudo cp gdb /usr/bin/arm-elf-gdb
You can test the ledtest application to i.MX27ADS supplied by OpenOCD:
Enter in ledtest directory:
$ cd openocd/testing/examples/ledtest-imx27ads
Run arm-elf-gdb passing as argument the gdbinit_imx27ads file:
$ arm-elf-gdb --command=gdbinit-imx27ads
You will see this gdb message:
$ arm-elf-gdb --command=gdbinit_imx27ads GNU gdb 6.6 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-linux". Setting up for the Freescale iMX27 ADS Board. The target endianness is set automatically (currently little endian) The target may not be able to correctly handle a memory-write-packet-size of 1024 bytes. Change the packet size? (y or n) [answered Y; input not from terminal] 0xc0000260 in ?? () JTAG device found: 0x1b900f0f (Manufacturer: 0x787, Part: 0xb900, Version: 0x1) JTAG device found: 0x07926121 (Manufacturer: 0x090, Part: 0x7926, Version: 0x0) target state: halted target halted in ARM state due to debug-request, current mode: Supervisor cpsr: 0x200000d3 pc: 0xc0000264 MMU: disabled, D-Cache: disabled, I-Cache: disabled Loading section .text, size 0x13c lma 0xa0000000 Start address 0xa0000000, load size 316 Transfer rate: 45963 bits/sec, 316 bytes/write. Warning: the current language does not match this frame. Breakpoint 1 at 0xa000008c: file test.c, line 12. Breakpoint 1, main () at test.c:12 12 volatile unsigned char *ledoff = ((volatile unsigned char *)0xD4000008); (arm-gdb)
Now issue continue (or just c) command and you will see D30 LED blinking!
(arm-gdb) c Continuing.
You can repeat this test and issue next (or just n) to debugging line by line then you can see the LED turning on and off. Using step (or just s) is not a good option because it will spend much time on for loop.