Tuesday, September 2, 2008

Openocd and JTAG

Finally got jtag working for the LPC-H2148, the config file with the openocd sources didnt quite work. The config below works with the Olimex parallel port wiggler and the usb ocd tiny, using the current openocd source (svn) built against the current libftdi, but NOT libft2xx. (dont need either of course for the parallel port). Uncomment the relevant section depending on the interface.

Changing the 14765 to 12000 (starting from the openocd config file) and adding the calc_checksum helped greatly. I dont know what the board/chip is doing but it helps greatly (if you cant connect) to power cycle the board, press the reset button a time or two, and run openocd (openocd -f filename.cfg). Telnet into openocd telnet localhost 4444

If you compiled for flash then:

reset halt
flash write_image erase blink.elf
reset


If you compiled to run out of ram only:

reset halt
load_image blink.elf
resume 0x40000000




#daemon configuration
telnet_port 4444
gdb_port 3333

#Parallel Port Interface
#interface parport
#parport_port 0
#parport_cable wiggler
#jtag_speed 0

# OpenOCD JTAG TINY
#interface ft2232
#ft2232_device_desc "Olimex OpenOCD JTAG TINY"
#ft2232_layout "olimex-jtag"
#ft2232_vid_pid 0x15BA 0x0004
#jtag_speed 20

#delays on reset lines
jtag_nsrst_delay 200
jtag_ntrst_delay 200

# NOTE!!! LPCs need reset pulled while RTCK is low. 0 to activate
# JTAG, power-on reset is not enough, i.e. you need to perform a
# reset before being able to talk to the LPC2148, attach is not
# possible.

#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_device 4 0x1 0xf 0xe

target arm7tdmi little 0 arm7tdmi-s_r4

working_area 0 0x40000000 0x4000 nobackup

#flash bank lpc2000 0x0 0x7d000 0 0 0 lpc2000_v2 14765
flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v2 12000 calc_checksum

No comments: