OpenOCD or debugger problem when debugging on ARM9(EP9302)?

Hi everyone!

Lucian is my name, not an english native speaker so excuse my mistakes.

I have a small problem when using my Olimex ARM-USB-OCD debugger with my CS-9302 Olimex board. It seems that whenever I run the command “ldr r1,[lr, #-4]” from the SWI interrupt handler the value read intro r1 is 0xdeeedeee instead of 0xef000000 as it should be.

If I run “ldr r1,[lr, #-8]” I get in r1 the right value from the memory.

If I run “ldr r1,[lr]” I get in r1 the right value once again. It seems that it happens only when reading using the #-4. It’s really odd and I don’t understand why this is actually happening.

.

And now the funny part, if I get to the instruction “ldr r1,[lr, #-4]” and don’t press from eclipse the F5(step) and I go and use telnet and tell it to do one step everything works fine.

However if I run the same operation from a function called from main the everything is fine like in this other picture.

Any ideas or suggestions? At the moment I can’t figure out what goes wrong here.

Thank you!

Lucian

Has the same problem :frowning: this Olimex ARM-USB-OCD debugger with my LPC 2478

now it is ARM7 TDMI core

Seems like openocd uses deeedeee as sowftware breakpoint command.

I am writing my own OS and has own SWI handler so this code are not worked

        STMFD	SP!,{LR}	; /*Save RET_ADDRESS free REGISTER*/
	LDRH	LR, [LR,#-2];
	BIC	LR, LR, #0xFF00;
	CMP	LR,#((SWI_FUNC_TABLE_END-SWI_FUNC_TABLE)/4);/* check the size of table*/
	LDRLO	PC, [PC, LR, LSL #2]; /*LOAD ADRESS FROM TABLE AND JUMP*/

Probably the problem is that in SWI mode sowtware breakpoint are not worked

there is some hacks coneccted with LR register

I wanted to know is it basic problem connected to JTAG or it is not so basic problem connected ONLY with

this ARM-USB-OCD debugger??? Can anybody guru confirm this theory?

Hi Dimitry,

It seems to be a problem when setting breakpoints right on the svc call. I managed to find a workaround this problem.

I placed all my SVC calls in separate functions, for debugging purposes only.

Enjoy your OS development! :slight_smile: