SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By fretkroket
Last week I received my ordered Olimex LPC-p2378 board with a ARM-USB-OCD programmer.

I installed the Olimex-GCCFD-240907.exe from the CD.
This installation should install the WinARM, OpenOCD and Eclipse.

Is there something else that I need to install? Like Cygwin?
and your problem is...?
By fretkroket
When I run openOCD, I get the next error:
Code: Select all
Info:    openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST)
Error:   ft2232.c:1341 ft2232_init_ftd2xx(): unable to open ftdi device: 2
Error:   ft2232.c:1356 ft2232_init_ftd2xx(): ListDevices: 2

Error:   ft2232.c:1358 ft2232_init_ftd2xx(): 0: Olimex OpenOCD JTAG B
Error:   ft2232.c:1358 ft2232_init_ftd2xx(): 1: X>
My config file is:
Code: Select all
#daemon configuration
telnet_port 4444
gdb_port 3333

interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG A"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003
jtag_speed 30
jtag_nsrst_delay 200
jtag_ntrst_delay 200

#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst separate

#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 <type> <startup mode>
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4
run_and_halt_time 0 30

target_script 0 reset openocd_flash_lpc2378.script 
working_area 0 0x40000000 0x7fff nobackup

#flash configuration
#flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14746 calc_checksum
flash bank lpc2000 0x0 0x80000 0 0 0 lpc2000_v2 12000 calc_checksum
#flash bank cfi 0x80000000 0x800000 2 2 0

# For more information about the configuration files, take a look at:
My script file:
Code: Select all
# The following command wills be executed on
# reset (because of run_and_init in the config-file)
# - wait for target halt
# - erase memory
# - flash content of file main.bin into target-memory
# - shutdown openocd
#  PRELIMINARY - first test for LPC2378
# Martin Thomas
# based on information from Dominic Rath

sleep 20

# ignore my comments - setup works without the following.
# disable PLL and switch to IRC (4 MHz nom.)
# hmm - should not be needed since IRC is default source after Reset...
# any interaction with the ISP startup??
# doesn't work anyway - something missing
# TODO: read manual.
#mww 0xE01FC080 0x00000000   # PLLCON  = 0
#mww 0xE01FC08C 0x000000AA   # PLLFEED = 0xAA
#mww 0xE01FC08C 0x00000055   # PLLFEED = 0x55
#mww 0xE01FC040 0x00000001   # MEMMAP  = 0x01
#sleep 10

arm7_9 dcc_downloads enable

flash probe 0

# erase complete flash:
#flash erase 0 0 26
# just erase the 3 first sectors of bank 0
flash erase_sector 0 0 5

flash write_image 0 main.bin 0x0

sleep 30
reset run
sleep 30
My makefile:
Code: Select all
NAME   = demo2378_blink_flash

CC      = arm-elf-gcc
LD      = arm-elf-ld -v
AR      = arm-elf-ar
AS      = arm-elf-as
CP      = arm-elf-objcopy
OD		= arm-elf-objdump

CFLAGS  = -I./ -c -fno-common -O0 -g
AFLAGS  = -ahls -mapcs-32 -o crt.o
LFLAGS  =  -Map -Tdemo2378_blink_flash.cmd
CPFLAGS = -O binary
HEXFLAGS = -O ihex
ODFLAGS	= -x --syms

all: test

	-rm crt.lst main.lst crt.o target.o main.o main.out main.hex main.dmp main.bin

test: main.out
	@ echo "...copying"
	$(CP) $(CPFLAGS) main.out main.bin
	$(OD) $(ODFLAGS) main.out > main.dmp
	@echo "...building hex"
	$(CP) $(HEXFLAGS) main.out main.hex

main.out: crt.o target.o fio.o irq.o main.o demo2378_blink_flash.cmd 
	@ echo "..linking"
	$(LD) $(LFLAGS) -o main.out  crt.o target.o fio.o irq.o main.o

target.o: target.c

	 $(CC) $(CFLAGS) target.c

fio.o: fio.c

	 $(CC) $(CFLAGS) fio.c
irq.o: irq.c

	 $(CC) $(CFLAGS) irq.c	  

crt.o: crt.s
	@ echo ".assembling"
	$(AS) $(AFLAGS) crt.s > crt.lst
I can compile a hex file, but can't run openOCD
Please reinstall the drivers for ARM-USB-OCD.

OpenOCD searches for FTD port named "Olimex OpenOCD JTAG A" (which is where JTAG is wired) but its description is somehow garbled.