ISR wrapper required ? - ARM7/LPC2378/GCC

apr-cn-eng wrote on Thursday, June 26, 2008:

Environment:
  FreeRTOS 5.0
  ARM7 / NXP LPC2378
  gcc 4.2.2 ; binutils 2.18

Based on some (maybe historic) comment in the forum and/or mailing list, I use the below construct for all my interrupt handlers.
Can anybody confirm or negate this is still needed or was needed at all ?

Thanks in advance,
  A. Pretzsch

static void XXXHandler(void)
{
   // real ISR
}

static void XXXIsr(void) __attribute__ ((naked));
static void XXXIsr(void)
{
    /* Save the context of the interrupted task. */
    portSAVE_CONTEXT();
    /* Call the handler.  This must be a separate function from the wrapper
       to ensure the correct stack frame is set up. */
    XXXHandler();
    /* Restore the context of whichever task is going to run next. */
    portRESTORE_CONTEXT();
}

davedoors wrote on Thursday, June 26, 2008:

As you are probably aware this was to work around a GCC bug. I don’t know if the latest GCC versions have fixed this or not but I think it is a good idea to keep it there.

apr-cn-eng wrote on Thursday, June 26, 2008:

Well, now I am :slight_smile:

I’ve got another remark in my Makefile, probably related:
# Probably needed due a compiler bug up till 4.2.1, see
# http://sourceforge.net/forum/message.php?msg_id=4594229
CFLAGS+=-fomit-frame-pointer

I didn’t have a look at the exact cause by now, neither at the current compiler status.

Do you know who discovered the problem, maybe he knows more ?
Might be worth a FAQ on the FreeRTOS site.
I’m not a fan of keeping workarounds forever…