Reply by Mario Ivancic October 7, 20102010-10-07
Hi,

Look up for msg #42152 (Data Abort Handler). That's what I use if I don't
have JTAG.

On Thu, Oct 7, 2010 at 5:12 PM, 42Bastian wrote:

> Just a note:
>
> > U32 *crash;
> > asm("mov %0, r5" : "=r" (crash) : );
>
> can be written
>
> register U32 *crash asm("r5");
>
> But I'd change the irq-routine to pass the crash-SP in r0 (1st parameter).
>
> --
> 42Bastian
> +
> | http://www.sciopta.com
> | Fastest direct message passing kernel.
> | IEC61508 certified.
> +
>
>
> Yahoo! Groups Links
--
Best regards,
Mario.

An Engineer's Guide to the LPC2100 Series

Reply by 42Bastian October 7, 20102010-10-07
Just a note:

> U32 *crash;
> asm("mov %0, r5" : "=r" (crash) : );

can be written

register U32 *crash asm("r5");

But I'd change the irq-routine to pass the crash-SP in r0 (1st parameter).

--
42Bastian
+
| http://www.sciopta.com
| Fastest direct message passing kernel.
| IEC61508 certified.
+
Reply by jhvdb October 7, 20102010-10-07
Problem sorted
I updated the IRQ_HANDLER to push SP to r5. In my WDT IRQ HANDLER I can now read reference the crash address with

U32 *crash;
asm("mov %0, r5" : "=r" (crash) : );
// Print out crash address
DBG("%08",*crash);

IRQ_Handler:
sub lr, lr, #4
stmfd sp!, {lr}
// NEW BLOCK
@- save r5 in stack
stmfd sp!, {r5}
@- move stack pointer to r5
mov r5, r13
@- adjust r5 to point to return address
sub r5, r5, #8
// END
mrs r14, SPSR
stmfd sp!, {r14}
stmfd sp!, {r0}
ldr r14, =LPC_BASE_VIC
ldr r0 , [r14, #VIC_VectAddr]
msr CPSR_c, Mode_SVC
stmfd sp!, { r1-r3, r12, r14 }
mov r14, pc
bx r0
ldmia sp!, { r1-r3, r12, r14 }
msr CPSR_c, #I_Bit | Mode_IRQ
ldmia sp!, {r0}
ldmia sp!, {r14}
msr SPSR_cxsf, r14
// NEW BLOCK
@- restore r5 from stack
ldmia sp!, {r5}
// END
ldmia sp!, {pc}^

--- In l..., "jhvdb" wrote:
>
> I wish to use the Watchdog Interrupt to debug the last code position where the application crashed.
>
> I assume I have to do a "Stack Trace" or "Stack Unwinding"?
> Can anyone please help with an implementation using WINARM for this?
>
> I tried debugged lr, pc and stepped up from the stack pointer but non of the debugs makes sense to me.
>
> I'm using the following IRQ entry code:
> sub lr, lr, #4
> stmfd sp!, {lr}
> mrs r14, SPSR
> stmfd sp!, {r14}
> stmfd sp!, {r0}
> ldr r14, =LPC_BASE_VIC
> ldr r0 , [r14, #VIC_VectAddr]
> msr CPSR_c, #Mode_SVC
> stmfd sp!, { r1-r3, r12, r14 }
> mov r14, pc
> bx r0
> ldmia sp!, { r1-r3, r12, r14 }
> msr CPSR_c, #I_Bit | Mode_IRQ
> ldmia sp!, {r0}
> ldmia sp!, {r14}
> msr SPSR_cxsf, r14
> ldmia sp!, {pc}^
>

Reply by jhvdb October 5, 20102010-10-05
I wish to use the Watchdog Interrupt to debug the last code position where the application crashed.

I assume I have to do a "Stack Trace" or "Stack Unwinding"?
Can anyone please help with an implementation using WINARM for this?

I tried debugged lr, pc and stepped up from the stack pointer but non of the debugs makes sense to me.

I'm using the following IRQ entry code:
sub lr, lr, #4
stmfd sp!, {lr}
mrs r14, SPSR
stmfd sp!, {r14}
stmfd sp!, {r0}
ldr r14, =LPC_BASE_VIC
ldr r0 , [r14, #VIC_VectAddr]
msr CPSR_c, #Mode_SVC
stmfd sp!, { r1-r3, r12, r14 }
mov r14, pc
bx r0
ldmia sp!, { r1-r3, r12, r14 }
msr CPSR_c, #I_Bit | Mode_IRQ
ldmia sp!, {r0}
ldmia sp!, {r14}
msr SPSR_cxsf, r14
ldmia sp!, {pc}^