5 msgput the process running in background
3 msgInstaling Gcc on Linux SLACKWARE
4 msghow is the eh_frame section used?
2 msgreordering-of-passes
3 msggcc_increase_max_array_size
6 msgresult type of an operation betweem signed and ...
2 msgLibjava.so
1 msgUsing __restrict__ on a class member variable
5 msgproblems with plotutils/libplot and windows 200...
7 msgDefault gcc tuning?
1 msgExclude function from gcov analysis
8 msgForcing inline assembly code to be produced
2 msgStrange behaviour of gcc on my 64-bit Pentium C...
2 msgOld -v behavior, display active -D defines
2 msgmmintrin slower than inline asm or even plain C
1 msgStandard Conformance with GCC and the C++ 2003 ...
1 msgautovectorization in gcc

-finline and ISRs
\ Edwin Olson (21 Apr 2007)
. \ Daniel Lohmann (23 Apr 2007)

2 msgdifferent output location for targets?
8 msgIs libc built by gcc?
Subject:-finline and ISRs
Group:Gcc-help
From:Edwin Olson
Date:21 Apr 2007


I'm working with a small embedded O/S on an ARM7TDMI.

A typical IRQ handler must save the state of a previous task, perform
some processing, possibly invoke the scheduler, and then restore a new
task. I'd like to do as much of this as possible from C, but
automatically generated prologue/epilogue chunks interfere with my
IRQ_TASK_SAVE/RESTORE macros (which are inline assembly). So I've been
doing this:

static void emac_irq(void) __attribute__ ((naked));
static void emac_irq(void)
{
IRQ_TASK_SAVE;
emac_irq_real();
IRQ_TASK_RESTORE;
}

Calling out to the actual ISR as a separate function call seems to
isolate stack variable allocations to the section between the
IRQ_TASK_SAVE/RESTORE.

This works pretty well, however, if I optimize at -O4, emac_irq_real is
inlined, and the IRQ handler no longer runs correctly. (I've verified:
the code works with -O4 -fno-inline, but doesn't work with just -O4).

I can attach a "noinline" attribute to emac_irq_real, which again causes
things to work, but the whole thing is starting to feel clumsy.

Does anyone have an idea of how I can do this in a more elegant way,
that doesn't require setting a bunch of attributes?

-Ed



© 2004-2008 readlist.com