Error: target 'lpc2000_v2' not defined

I am having a problem I can’t seem to see documented for anyone else, I am building from git,

git log says this is the last commit:

commit 75c706cc043183d98592dbe3c6f170d627849d0f
Author: David Brownell <dbrownell@users.sourceforge.net>
Date:   Fri Dec 11 15:26:10 2009 -0800

I did a standard build for openocd with a configure:

./configure --enable-maintainer-mode --enable-ft2232_ftd2xx

my openocd.cfg looks like this:

interface ft2232
ft2232_device_desc "Signalyzer A"
ft2232_layout signalyzer
ft2232_vid_pid 0x0403 0xbca0

#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
#jtag_device 4 0x1 0xf 0xe

set _CHIPNAME lpc2468
set  _ENDIAN little
set _CPUTAPID 0x401f002b

#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 0x3 -expected-id $_CPUTAPID

set _TARGETNAME [format "%s.cpu" $_CHIPNAME]
target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm7tdmi-s_r4
$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x40000000 -work-area-size 0x4000 -work-area-backup 0

flash bank lpc2000 0x0 0x7ffff 0 0 $_TARGETNAME \
	lpc2000_v2 25000

and i get this result:

$ openocd
Open On-Chip Debugger 0.4.0-dev-00925-g75c706c (2009-12-15-08:27)
For bug reports, read
	http://openocd.berlios.de/doc/doxygen/bugs.html
trst_and_srst srst_pulls_trst srst_gates_jtag trst_push_pull srst_open_drain
Error: Invalid command argument
Error: target 'lpc2000_v2' not defined
Command handler execution failed

Also, jtag_device 4 0x1 0xf 0xe, give an error about how jtag_device is an unknown command. Searching the documentation it seems that this is a correct fact but all example .cfg files use this command…

Anyone know anything about how to fix this? Could it be something simple like i need another configure flag? Thanks for helping.

i do have libftd2xx.so.0.4.15 and I followed the README.dat for install.

for other searchers information, I seem to be a bit further on this issue. It turns out that the document writers and the code writers are out of sync, the real line is as follows:

#flash bank <name> <driver> <base> <size> <chip_width> <bus_width>
flash bank lpc2000 lpc2000 0 524288 32 32 $_TARGETNAME lpc2000_v2 25000

I would not go as far as to say this is working for me, but it is not bombing on me anymore.

Hi, I had the same problem just read this thread, changed my lpc2103 according to Your code and now I can finally connect to my board.

(I’m not saying everything works, but still…)

thumbs up

Similar problem here when installing OpenOCD 0.4.0.

Error: target ‘lpc2000_v1’ not defined

For my LPC2106 this now works with OpenOCD 0.4.0:

flash bank lpc2000 lpc2000 0x0 0x20000 32 32 $_TARGETNAME lpc2000_v1 14746 calc_checksum

Thanks dude.

David

To All,

You do not seem to have all the args for the flash bank command aligned properly.

Note the number of args seems to vary between versions of OpenOCD so look carefully.

RTFM http://openocd.berlios.de/doc/html/Flash-Commands.html

12.1 Flash Configuration Commands

— Config Command: flash bank name driver base size chip_width bus_width target [driver_options]

Configures a flash bank which provides persistent storage for addresses from base to base + size - 1. These banks will often be visible to GDB through the target’s memory map. In some cases, configuring a flash bank will activate extra commands; see the driver-specific documentation.

  • name … may be used to reference the flash bank in other flash commands. A number is also available.

  • driver … identifies the controller driver associated with the flash bank being declared. This is usually cfi for external flash, or else the name of a microcontroller with embedded flash memory. See Flash Driver List.

  • base … Base address of the flash chip.

  • size … Size of the chip, in bytes. For some drivers, this value is detected from the hardware.

  • chip_width … Width of the flash chip, in bytes; ignored for most microcontroller drivers.

  • bus_width … Width of the data bus used to access the chip, in bytes; ignored for most microcontroller drivers.

  • target … Names the target used to issue commands to the flash controller.

  • driver_options … drivers may support, or require, additional parameters. See the driver-specific documentation for more information.

Note: This command is not available after OpenOCD initialization has completed. Use it in board specific configuration files, not interactively.

Note the options after target_name - use 0 to give a default value. The Clk freq has to be about right or you will have unreliable write to flash

#flash bank <base_addr> <chip_width> <bus_width> <target_number> [<target_name> <sectors_per_bank> <pages_per_sector> <page_size> <num_nvmbits> <ext_freq_khz>]

Example

flash bank lpc288x 0 0 0 0 $_TARGETNAME 0 0 0 0 0 12000000

Ernest