piclist 2001\01\15\114124a >
Thread: PCW C Compiler - How do I Minimise Stack level usage ?
face BY : Mike Mansheim email (remove spam text)

>>Without resorting to messy solutions such as software stacks, you will
>>to rewrite the code to minimise nested function calls.  It may be
>>to convert a small function to a macro so the code will be "inlined".
>>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"
which will save stack space at the expense of program memory (the converse
also available - the "#separate" directive).
If you enable the "generate call tree" option (node properties), the
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
file is only current after a successful compile.
Proper use of these directives *might* let you solve the problem without
writing code.
This is discussed a bit in the CCS manual in the "common questions and
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 listservTakeThisOuTspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


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...