EmbeddedRelated.com
Forums

Question about HiTech C Compiler on Pic (16F876)

Started by Bob March 9, 2004
I am using the HiTech C compiler version 8.02 PL1.
I would like to modify my makefile so that when my code
compiles, it shows the number of call stack levels used. 
This way I can be sure that I don't go over 8 anywhere in my
code.

The only place I have found call stack information is in graphical
format in the MAP file. I don't want to manually count the stack
levels each time.Is there any other place where the call stack level
is listed?

In the CCS compiler, I can get this info from the .LST file.

Thanks,

Bob
On 9 Mar 2004 12:38:29 -0800, google.4.oracle@xoxy.net (Bob) wrote:

>I am using the HiTech C compiler version 8.02 PL1. >I would like to modify my makefile so that when my code >compiles, it shows the number of call stack levels used. >This way I can be sure that I don't go over 8 anywhere in my >code. > >The only place I have found call stack information is in graphical >format in the MAP file. I don't want to manually count the stack >levels each time.Is there any other place where the call stack level >is listed?
No. I think that if I were forced to automate this process, I would write a Perl or awk script to do it. -- Dan Henry
Bob wrote:
> I am using the HiTech C compiler version 8.02 PL1. > I would like to modify my makefile so that when my code > compiles, it shows the number of call stack levels used. > This way I can be sure that I don't go over 8 anywhere in my > code. > > The only place I have found call stack information is in graphical > format in the MAP file. I don't want to manually count the stack > levels each time.Is there any other place where the call stack level > is listed? > > In the CCS compiler, I can get this info from the .LST file. > > Thanks, > > Bob
A lot of people have struggled with this one. A closer look at the .map file shows the indent format is not straightforward. It does not clearly show where a jump is used instead of a branch and I recall there may be different formats for functions with and without arguments. Then there are indirect calls ... But in general once you have identified the worst case(s), you can examine the listings in more detail. IMO the best long term solution is to upgrade to the 18F series with 30 stack locations, especially if you need a lot of ROM or RAM. Hitech's compiler is very capable. I used an 18F452 on a job and it paid for itself because it got rid of two large EEPROMs used for overflow storage. -- Mike Page BEng(Hons) MIEE www.eclectic-web.co.uk