ARM Technical Support Knowledge Articles

PROBLEMS WITH LOCAL VARIABLES IN INTERRUPTS

Applies to: GNU C Compiler for ARM

Answer


Information in this article applies to:


QUESTION

I have a complex interrupt function that uses local variables. It seems that the GNU compiler does not generate correct code for it. Is there a known problem?

My code looks like:

void intr_func (void) __attribute__ ((interrupt));    // Generate Interrupt

void intr_func (void)  {
  int a, b, c, d;

  :   /* function code */
}

ANSWER

Yes, there is a problem in the GNU V3.22 compiler. For the moment, we recommend using the following work-around:

void intr_wrapper (void) __attribute__ ((interrupt));    // Generate Interrupt

void intr_wrapper (void)  {
  intr_func ();
}

Use the wrapper function around the interrupt and the correct code is generated.

Article last edited on: 2006-07-10 18:30:41

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential