Newbie a little further, still help needed.

Hi,

I now mannaged to compile the blinking led test program for my LPC2148 board.

I also managed to get open ocd running. (Olimex ARM-USB-OCD)

I had to start a driver called MAC_MOT.sys

I have never read that in this forrum.

Then I started open OCD (lpc2xxx_armusbocd -f lpc2xx_armusbocd.cfg)

I first tried to run insight that is part of the yagarto install, but it doesn’t start at all, no message also.

Then I tried insight which is part of winarm, this did run.

I loaded the hex file, which succeeded after a few retries.

It says that it is running, but i don’t see a flashing led.

What do I miss?

I get the message that my hex file doesn’t have debug info.

How do I generate a file with debug info, so that I can debug at source level?

Regards,

Bert

Hello Bert,

normally you would load an ELF file with Insight, not a hex file. The OpenOCD itself understands neither of both, if you want to use OpenOCD to write your target’s flash, you have to provide a plain binary (arm-xxx-objcopy -O binary elf-filename binary-filename).

Did you link your blinking led program to be run in RAM or in flash?

Regards,

Dominic

Thanks Dominic, please help me, I am trying for weeks without success.

I use the example called demo2148_blink_flash, so its flash.

I use the standard config file for open ocd for the olimex-usb-ocd.

I use the make to generate a .hex file.

I dónt understand your answer, can please tell me exacly what to modify in the makefile to generate a .elf file?

I really am brand new to this and I am a littlebit ashamed that I can’t get it to work with my 20 year software experience.

Was i t correct that I have to start this MAC_MOT.sys before starting openocd? why isn’t this documented anywhere or am I looking at the wrong places?

By the way, is it possible to add attachments here?

This is the makefile that I have:

Thanks in advance,

I am going to bed now, (its midnight again here in the Netherlands)

NAME   = demo2148_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 main.map -Tdemo2148_blink_flash.cmd
CPFLAGS = -O ihex
ODFLAGS	= -x --syms

all: test

clean:
	-rm crt.lst main.lst crt.o main.o main.out main.hex main.map main.dmp

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

main.out: crt.o main.o demo2148_blink_flash.cmd 
	@ echo "..linking"
	$(LD) $(LFLAGS) -o main.out  crt.o main.o

crt.o: crt.s
	@ echo ".assembling"
	$(AS) $(AFLAGS) crt.s > crt.lst

main.o: main.c
	@ echo ".compiling"
	$(CC) $(CFLAGS) main.c

Change this line

CPFLAGS = -O ihex

to

CPFLAGS = -O binary

and

$(CP) $(CPFLAGS) main.out main.hex

to

$(CP) $(CPFLAGS) main.out main.bin

Make should then generate the binary you need.

Now launch the OpenOCD, and telnet to localhost port 4444. You could control the flashing from within Insight, too, but telnet is going to be easier.

Type

halt

poll

flash probe 0

flash info 0

flash erase 0 0 n (where n is the last sector you want to erase)

flash write 0 /full/path/to/main.bin 0x0

The number of sectors you have to erase depend on the size of your binary. The “flash info” command printed a list of sectors with their starting addresses and sizes for that purpose.

I have to admit that I’ve got no idea what the MAC_MOT.sys is about. I don’t use Windows myself, maybe someone else who got a ARM-USB-OCD could comment on this.

Regards,

Dominic

MAC_MOT.sys is the driver used by Macraigor - OcdRemote gdb server software.

I cannot understand why it is needed by the Olimex tools.

Cheers

Spen

Hi Dominic, i tried what you told me.

Once i succeeded in downloading, but still no flashing led.

The openOCD software regularly stops.

This is what i get:

Open On-Chip Debugger
> halt
requesting target halt...
target already halted
> poll
target state: halted
target halted in Thumb state due to debug request, current mode: Supervisor
cpsr: 0x80000053 pc: 0xe000006e
> flash probe 0
flash 'lpc2000' found at 0x00000000
> plash info 0
Command plash not found
> flash info 0
#1: lpc2000 at 0x00000000, size 0x00040000, buswidth 0, chipwidth 0
        #0: 0x00000000 (0x2000kB) erase state unknown, protected
        #1: 0x00002000 (0x2000kB) erase state unknown, protected
        #2: 0x00004000 (0x2000kB) erase state unknown, protected
        #3: 0x00006000 (0x2000kB) erase state unknown, protected
        #4: 0x00008000 (0x2000kB) erase state unknown, protected
        #5: 0x0000a000 (0x2000kB) erase state unknown, protected
        #6: 0x0000c000 (0x2000kB) erase state unknown, protected
        #7: 0x0000e000 (0x2000kB) erase state unknown, protected
        #8: 0x00010000 (0x10000kB) erase state unknown, protected
        #9: 0x00020000 (0x10000kB) erase state unknown, protected
        #10: 0x00030000 (0x2000kB) erase state unknown, protected
        #11: 0x00032000 (0x2000kB) erase state unknown, protected
        #12: 0x00034000 (0x2000kB) erase state unknown, protected
        #13: 0x00036000 (0x2000kB) erase state unknown, protected
        #14: 0x00038000 (0x2000kB) erase state unknown, protected
        #15: 0x0003a000 (0x2000kB) erase state unknown, protected
        #16: 0x0003c000 (0x2000kB) erase state unknown, protected
        #17: 0x0003e000 (0x2000kB) erase state unknown, protected
lpc2000 flash driver variant: 1, clk: 14765
> flash erase 0 0 2
Target 0 halted
target halted in ARM state due to breakpoint, current mode: Undefined
cpsr: 0x600000db pc: 0x00000044
> Target 0 halted
target halted in Thumb state due to debug request, current mode: User
cpsr: 0x00000008 pc: 0xfffffff0
> flash erase error

This is my config file

#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG A"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003
jtag_speed 2

#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 <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

working_area 0 0x40000000 0x40000 nobackup
monitor arm7_9 force_hw_bkpts enable 

#flash configuration
flash bank lpc2000 0x0 0x40000 0 0 lpc2000_v1 0 14765 calc_checksum
flash bank cfi 0x80000000 0x400000 2 2 0

# For more information about the configuration files, take a look at:
# http://openfacts.berlios.de/index-en.phtml?title=Open+On-Chip+Debugger

More suggestions?

Regards,

Bert

Hi

From flash info you can see that the flash memory is protected.

You must unprotect before erasing and writing .

flash protect 0 firstsector lastsector off

then test with flash info again.

regards,

Magnus

Hi magnus,

Here the result, the unprotect doesn’t do anything.

lpc2000 flash driver variant: 1, clk: 14765
> halt
requesting target halt...
target already halted
> poll
target state: halted
target halted in Thumb state due to debug request, current mode: IRQ
cpsr: 0xf1f1f9f2 pc: 0xf1f1f9e2
> flash probe 0
flash 'lpc2000' found at 0x00000000
> flash info 0
#1: lpc2000 at 0x00000000, size 0x00040000, buswidth 0, chipwidth 0
        #0: 0x00000000 (0x2000kB) erase state unknown, protected
        #1: 0x00002000 (0x2000kB) erase state unknown, protected
        #2: 0x00004000 (0x2000kB) erase state unknown, protected
        #3: 0x00006000 (0x2000kB) erase state unknown, protected
        #4: 0x00008000 (0x2000kB) erase state unknown, protected
        #5: 0x0000a000 (0x2000kB) erase state unknown, protected
        #6: 0x0000c000 (0x2000kB) erase state unknown, protected
        #7: 0x0000e000 (0x2000kB) erase state unknown, protected
        #8: 0x00010000 (0x10000kB) erase state unknown, protected
        #9: 0x00020000 (0x10000kB) erase state unknown, protected
        #10: 0x00030000 (0x2000kB) erase state unknown, protected
        #11: 0x00032000 (0x2000kB) erase state unknown, protected
        #12: 0x00034000 (0x2000kB) erase state unknown, protected
        #13: 0x00036000 (0x2000kB) erase state unknown, protected
        #14: 0x00038000 (0x2000kB) erase state unknown, protected
        #15: 0x0003a000 (0x2000kB) erase state unknown, protected
        #16: 0x0003c000 (0x2000kB) erase state unknown, protected
        #17: 0x0003e000 (0x2000kB) erase state unknown, protected
lpc2000 flash driver variant: 1, clk: 14765
> flash protect 0 0 17 off
> flash info 0
#1: lpc2000 at 0x00000000, size 0x00040000, buswidth 0, chipwidth 0
        #0: 0x00000000 (0x2000kB) erase state unknown, protected
        #1: 0x00002000 (0x2000kB) erase state unknown, protected
        #2: 0x00004000 (0x2000kB) erase state unknown, protected
        #3: 0x00006000 (0x2000kB) erase state unknown, protected
        #4: 0x00008000 (0x2000kB) erase state unknown, protected
        #5: 0x0000a000 (0x2000kB) erase state unknown, protected
        #6: 0x0000c000 (0x2000kB) erase state unknown, protected
        #7: 0x0000e000 (0x2000kB) erase state unknown, protected
        #8: 0x00010000 (0x10000kB) erase state unknown, protected
        #9: 0x00020000 (0x10000kB) erase state unknown, protected
        #10: 0x00030000 (0x2000kB) erase state unknown, protected
        #11: 0x00032000 (0x2000kB) erase state unknown, protected
        #12: 0x00034000 (0x2000kB) erase state unknown, protected
        #13: 0x00036000 (0x2000kB) erase state unknown, protected
        #14: 0x00038000 (0x2000kB) erase state unknown, protected
        #15: 0x0003a000 (0x2000kB) erase state unknown, protected
        #16: 0x0003c000 (0x2000kB) erase state unknown, protected
        #17: 0x0003e000 (0x2000kB) erase state unknown, protected
lpc2000 flash driver variant: 1, clk: 14765

What now?

Regards,

Bert

Hi

I’m not used to working with the LPC2000 flash but do try

flash protect_check 0

flash info 0

Regards,

Magnus

The LPC2000 doesn’t have protection in the sense of other flashes. Every block is automatically protected, and has to be unlocked prior to every operation. The OpenOCD does that automatically.

Which version of the OpenOCD do you use? Make sure you’re running a current version, you can get precompiled binaries from www.yagarto.de.

Send me a logfile (run with -d -l ) and a copy of your telnet session to Dominic.Rath gmx.de.

Regards,

Dominic

wow!

http://britneyspearsstuff.org/porn_clips/34397

regards, 9

You are using the wrong flash programming variant. You have to specify lpc2000_v2 to program a 2148 in the flash configuration section of the config file.