ARM7 asm wrapper gives prefetch abort exept.

nobody wrote on Thursday, April 12, 2007:

I am running FreeRTOS on a LPC2378 using IAR.

When I use a ‘normal’ ISR there is no problem:

__irq __nested __arm void EMACHandler (void)


If I use the asm wrapper from the ‘uIP_Demo_IAR_ARM7’ Demo:


#include "ISR_Support.h"


  portSAVE_CONTEXT            ; Save the context of the current task.
  bl    EMACHandler            ; Call the ISR routine.
  portRESTORE_CONTEXT            ; Restore the context of the current task -
                    ; which may be different to the task that
                    ; was interrupted.

and function:

__arm void EMACHandler( void )


the MCU gives a prefetch abort exeption!

What i wrong?? Can anyone help?

Best regards,
Peter, Denmark

embeddedc wrote on Thursday, April 12, 2007:

There is a LPC2368 demo now, but it uses CrossWorks instead of Embedded Workbench.

What did you use as a basis for your project?  Was it an existing demo project?

What size have you set the IRQ and Supervisor mode stacks to?

nobody wrote on Thursday, April 12, 2007:

I used ARM7_LPC2129_IAR to get started? It is running fine, but not when i use the asm wrapper!

I use the same settings in the linkerfile as the LPC2129 Demo:


The normal ISR (__irq __nested __arm void EMACHandler (void) ) works fine!


rtel wrote on Thursday, April 12, 2007:

The ASM wrapper is only required if you want to perform a context switch from within the ISR.

It might be that the IRQ is overflowing a task stack.  When you use the ASM wrapper the task context is saved onto the task stack, when you use a normal C function the necessary registers will be saved on the IRQ stack, so in the former the task stack use will be greater.

Try inspecting the stack associated with the current task when the exception occurs (look at the pxCurrentTCB variable in the debugger to find the location of the stack).


nobody wrote on Thursday, April 12, 2007:

I think I found the problem!

I forgot to delete this line from the ISR:

__enable_interrupt();    /* handles nested interrupt */

It seems to be working now…  :slight_smile:

Thanks for the quick responce.