I have just installed OpenOCD 0.4.0 on Ubuntu 11.04 and openSUSE 11.4 and want to make my results available to others. I was using a build from 2007, so the overhaul in the configuration files took me quite a while to sort out. i hope others can benefit from this.
I am using an Olimex ARM-USB-OCD with their ARM7 boards.
I have installed libftdi (using Synaptic on Ubuntu and source code on openSUSE).
I have added a file to the udev rules /etc/udev/rules.d/45-ft2232.rules:
BUS!="usb", ACTION!="add", SUBSYSTEM!=="usb_device", GOTO="kcontrol_rules_end"
SYSFS{idProduct}=="0003", SYSFS{idVendor}=="15ba", MODE="664", GROUP="plugdev"
LABEL="kcontrol_rules_end"
This is so that a “normal” user has read/write access to the usb devices. Unplug and replug in the Olimex programmer after having added this file so the nodes are created with the correct permissions.
I have also blacklisted ftdi_sio by adding the following line to /etc/modprobe.d/blacklist.conf
blacklist ftdi_sio
I did not need to blacklist the usbserial module.
I downloaded openocd-0.4.0 and configured using:
LIBS=-lusb ./configure --enable-ft2232_libftdi --enable-arm-jtag-ew
then did a ‘make’ and ‘make install’.
I needed the LIBS option as the libusb library did not seem to be included in the configuration.
I then created the configuration file openocd.cfg:
# daemon
telnet_port 4444
gdb_port 3333
#interface - ft2232
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG"
ft2232_layout olimex-jtag
ft2232_vid_pid 0x15ba 0x0003
jtag_nsrst_delay 200
jtag_ntrst_delay 200
jtag_khz 10
#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst
# target configuration
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME str710
}
if { [info exists ENDIAN] } {
set _ENDIAN $ENDIAN
} else {
set _ENDIAN little
}
if { [info exists CPUTAPID] } {
set _CPUTAPID $CPUTAPID
} else {
set _CPUTAPID 0x3f0f0f0f
}
#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst srst_pulls_trst
#jtag scan chain
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0x0f -expected-id $_CPUTAPID
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm7tdmi
# run flash script on reset-init
$_TARGETNAME configure -event reset-init "script flash.script"
$_TARGETNAME configure -work-area-phys 0x2000C000 -work-area-size 0x4000 -work-area-backup 0
#flash bank str7x <base> <size> 0 0 <target#> <variant>
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME str7x 0x40000000 0x00040000 0 0 $_TARGETNAME STR71x
# trigger flash script
init
sleep 10
reset init
sleep 10
reset run
sleep 10
reset
sleep 10
shutdown
The flash.script file is:
halt
sleep 10
arm7_9 dcc_downloads enable
arm7_9 fast_memory_access enable
halt
sleep 10
poll
# STR710FZ2/STR711FR2 erase all banks:
flash erase_sector 0 0 last
# flash write_image erase main.bin 0x40000000 bin
flash write_bank 0 main.bin 0x0
So now running openocd in the directory with the script files and the main.bin file now works…