Keil™, An ARM® Company

Discussion Forum

Prefetch Abort

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Malcom -
Posted
21-Mar-2006 16:17
Toolset
ARM
New! Prefetch Abort
Hi All,

I'm getting a PAbt_Handler call and want to trace the source as I'm not sure how this error is occurring...

I'm only using the on-chip flash and ram (target is LPC2148) so how can I be executing code at an invalid memory address??


If I can just return to the calling address that would be better than a total crash.

Thanks for your help,

Malcom
Read-Only
Author
Reinhard Keil
Posted
22-Mar-2006 09:34
Toolset
ARM
New! RE: Prefetch Abort
Take a look here:
http://www.keil.com/support/docs/3080.htm

It will also work for the PAbt_Handler

Reinhard
Read-Only
Author
Bruce McKenney
Posted
22-Mar-2006 09:38
Toolset
ARM
New! RE: Prefetch Abort
> I'm only using the on-chip flash and ram
> (target is LPC2148) so how can I be executing
> code at an invalid memory address??

Flash+RAM only covers a small portion of the
(4GB) address space, so there are plenty of
bad code addresses. Prime candidates:

1) Bad address in VIC
2) Indirect call "(*f)()" using an
uninitialized/mangled pointer.
3) "return" after overwriting the stack.

It's not useful to "just return" since it's
not clear where you would return to -- the
address in R14 is already known to be bad.
You can't use the stack directly since you
may not have gotten there using a call.

Debugging this is workable but rarely
formulaic. How much visibility do you have?
Full debugging (JTAG, e.g.)? Clues:
1) Does R14 look like anything recognizable?
(ASCII characters? A valid pointer with
a stray bit set?) There may be a clue
here.
2) Look in SPSR to see what the Abort-ed
mode was. Use that to find the appropriate
SP value and work backwards from there.
Again, you may not have got here using
a call, so you'll have to interpolate,
but you can see where you've been
"recently", which might narrow things
down.
Read-Only
Author
Malcom -
Posted
22-Mar-2006 10:56
Toolset
ARM
New! RE: Prefetch Abort
Thanks chaps,

I've implemented the following routine to track down the source:

void PAbt_Handler(void) __irq
{
unsigned int CrashSite;
__asm {
MOV R0,LR
STAV R0,R1,CrashSite
}
printf("*** PAbt_Handler Called From Addr: %X ***\r\n", CrashSite - 8);
}


Best regards,

Malcom
Read-Only
Author
Malcom -
Posted
22-Mar-2006 16:23
Toolset
ARM
New! RE: Prefetch Abort
Reinhard,

I think I found an error in the Startup.s for the Philips.

My problem was that data was appearing in the middle of the user stack. I was trying to find out the required stack sizes by settting all the stacks to 0xCC at the begining. On my first function call data appeared in the middle of the stack???

This got be looking through startup.s where I found:

// Enter User Mode and set its Stack Pointer
MSR CPSR_c, #Mode_USR
MOV SP, R0


This sets the R13(SP) to a mid-stack address instead of the top.

I think the correct assembler should be:

// Enter User Mode and set its Stack Pointer
MSR CPSR_c, #Mode_USR|I_Bit|F_Bit
MOV SP, R0


I'll post this to support as well as this could be catching a lot of people out.

Best regards,

Malcom

Next Thread | Thread List | Previous Thread Start a Thread | Settings