piclist 2001\01\15\114124a >
Thread: PCW C Compiler - How do I Minimise Stack level usage ?
www.piclist.com/techref/microchip/languages.htm?key=c
flavicon
face BY : Mike Mansheim email (remove spam text)



>>Without resorting to messy solutions such as software stacks, you will
have
>>to rewrite the code to minimise nested function calls.  It may be
possible
>>to convert a small function to a macro so the code will be "inlined".
This
>>will reduce stack useage at the expense of code size.

> I have a problem that my program produce code that use the stack 9 levels
> deep. The pic16f877 has a 8 level stack. Help  C Fundies?

With the CCS compiler, you can inline functions with the "#inline"
directive,
which will save stack space at the expense of program memory (the converse
is
also available - the "#separate" directive).
If you enable the "generate call tree" option (node properties), the
compiler
will create a .tre file in the project directory that you can look at to
determine where the #inline directive could best be utilized.  Note that
this
file is only current after a successful compile.
Proper use of these directives *might* let you solve the problem without
re-
writing code.
This is discussed a bit in the CCS manual in the "common questions and
answers"
section (albeit for a different problem), in the answer to "Why do I get an
OUT OF ROM error when there seems to be ROM left?"

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email TakeThisOuTlistservTakeThisOuTspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


<OF669F0B1C.71C6F1CF-ON862569D5.005A2808@msp.graco.com>

See also: www.piclist.com/techref/microchip/languages.htm?key=c
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) PCW C Compiler - How do I Minimise Stack level usage ?

month overview.

new search...