wiki:Debugging/OpenOCD/LPC17xx

OpenOCD Configuration for LPC17xx

The OpenOCD includes directly configuration for MBED LPC1768 based board (mbed-lpc1768.cfg)

We use next configuration for our own FTDI based Edgewall Software JT_USB5/6] JTAG pod for our LPC4088 based boards (LX_CPU).

The presented configuration variant starts the target first to allow setup SDRAM by boot loader code and then application is loaded over GDB/DDD to SDRAM

File "lx_cpu-lpc4088.cfg":

# This is configuration for PiKRON's LX_CPU1 based on NXP LPC4088 chip.
# http://pikron.com/pages/products/cpu_boards/lx_cpu.html

#daemon configuration
telnet_port 4444
gdb_port 3333

adapter_khz 1000

source [find jt_usb5-jtag.cfg]

source [find target/lpc40xx.cfg]

init

reset init
#wait_halt
resume
sleep 1000
halt
wait_halt

adapter_khz 1000

File jt_usb5-jtag.cfg:

interface ftdi
#ftdi_device_desc "Dual RS232"
ftdi_vid_pid 0x0403 0x6010

ftdi_layout_init 0x0cf8 0x0cfb

#ftdi_layout_signal nTRST -data 0x0010 -noe 0x0800
#ftdi_layout_signal nSRST -ndata 0x0040 -noe 0x0400
#ftdi_layout_signal SWD_EN -nalias nTRST
#ftdi_layout_signal SWDIO_OE -alias TMS

ftdi_layout_signal nTRST -data 0x0010
ftdi_layout_signal nSRST -ndata 0x0040

ftdi_layout_signal LED -data 0x0800

transport select jtag

#transport select swd
#ftdi_layout_signal SWD_EN -ndata 0x0400
#ftdi_layout_signal SWDIO_OE -alias TMS

File gdb-openocd.init:

#set endian big
target remote localhost:3333
#load

File "lx_cpu-jt_usb5-ddd" for combined start of GDB and DDD.

#!/bin/sh

SCRIP_DIR="$(dirname "$(readlink -f "$0")")"

nc -w 3 -z localhost 4444
if [ $? -ne 0 ]
then
  echo "Starting OpenOCD"
  openocd -f "$SCRIP_DIR/lx_cpu-lpc4088.cfg" &
  OPENOCD_PID=$!
  nc -w 10 -z localhost 4444
  if [ $? -ne 0 ]
  then
    echo "OpenOCD start failed"
  fi
fi

sleep 10

ddd --debugger arm-elf-gdb -x "$SCRIP_DIR/gdb-openocd.init" "$1"

kill $OPENOCD_PID
Last modified on Sep 17, 2015 at 4:38:59 PM Last modified on Sep 17, 2015, 4:38:59 PM