Hello!
I have bought LPC-P2138 and ARM-USB-OCD and have tried to get it to work under Linux using Insight during a long time. Reading this newsgroup and other newsgroups has helped me slightly, but the last obstacle is still there.
My arm-elf chain is basically compiled after www.openhardware.net. OpenOCD is subversion version 225, ie fairly late.
My test program is small flash based program. I hope and assume that it should be possible to debug applications in flash on the LPC2138.I have managed to download this small program (does not set up stack et al, but lights one of the LEDs) using serial port and the telnet interface to OpenOCD. The telnet commands are:
halt
flash write_image <filename.elf> 0 elf
resume 0
When I try to download the same application using Insight it fails with the error :
Warning: arm7_9_common.c:2074 arm7_9_write_memory(): memory write caused data abort (address: 0x00000000, size: 0x4, count: 0x1b)
The config is as follows:
#daemon configuration
telnet_port 4444
gdb_port 3333
#interface
interface ft2232
ft2232_device_desc “Olimex OpenOCD JTAG”
ft2232_layout “olimex-jtag”
ft2232_vid_pid 0x15ba 0x0003
jtag_speed 3
#use combined on interfaces or targets that can’t set TRST/SRST separately
reset_config trst_and_srst srst_pulls_trst
#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe
#target configuration
daemon_startup reset
#target
#target arm7tdmi
target arm7tdmi little run_and_init 0 arm7tdmi-s_r4
flash-options LPC2138
target_script 0 reset openocd_lpc2138_flash.script
run_and_halt_time 0 30
working_area 0 0x40000000 0x40000 nobackup
LPC2138 @ 12MHz / 0x7D000 from 500*1024 (not 512!)
up to version SVN188:
#flash bank lpc2000 0x0 0x7D000 0 0 lpc2000_v2 0 12000 calc_checksum
from Version SVN189:
#flash bank lpc2000 0x0 0x7D000 0 0 0 lpc2000_v2 12000 calc_checksum
flash bank lpc2000 0x0 0x7D000 0 0 0 lpc2000_v2 14745 calc_checksum
For more information about the configuration files, take a look at:
http://openfacts.berlios.de/index-en.ph … p+Debugger
The script is as follows:
#Based on information from
http://www.openhardware.net/Embedded_ARM/OpenOCD_JTAG/
halt
sleep 10
arm7_9 dcc_downloads enable
arm7_9 write_xpsr 0x000000d3 0 * Enable IRQ, FIQ and Supervisor mode
mww 0xE01FC040 0x00000001 #MEMMAP: User flash mode
sleep 10
arm7_9 force_hw_bkpts enable # program resides in Flash
#arm7_9 force_hw_bkpts disable # program resides in RAM
flash auto_erase on
Best regards,
/Stefan