ARM Technical Support Knowledge Articles

SAVING EXTRA VARIABLES ON THE STACK

Applies to: C51 C Compiler

Answer

Information in this article applies to:


QUESTION

I want to push extra variables onto the stack in an interrupt service routine (in addition to what the compiler has already saved). How can I do that?

ANSWER

Probably the best way to save additional data on the stack in an interrupt service routine is:

  1. Include in-line assembly code in the ISR to push and pop the variables.
  2. Generate an assembly file for the C file. Use the #pragma SRC directive for that. Then, directly modife the SRC file, assemble it, and include it in the linker command line.

Article last edited on: 2005-07-09 11:28:44

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