CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Stack Size and Profiling

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dcm684



Joined: 08 Sep 2010
Posts: 8

View user's profile Send private message

Stack Size and Profiling
PostPosted: Wed Sep 08, 2010 11:15 am     Reply with quote

I was reading through the FAQ and noticed that the sum of my stack usage should be less than 9. Currently my stack usage is 14 (7 in main + 7 in ISR).

Is there a software means of profiling my stack usage to find where the software stack is being used? Or is the only way to find stack usage is to find where a function is being called by both the ISR as well as via the main() routine?

Even though I don't believe that I have had any problems related to the stack in the past two years, where is has always been 12 or more), I am now running in to some erratic behavior that might be related to stack overflow. Could a stack overflow cause the CCP5CON special function register to be cleared? And could a stack overflow cause the following to occur:

Code:
char aChar = 'f';
int8 anInt = 16;
fprintf(UART1, "%c %X", aChar, anInt);

This sometimes prints "%c %X" instead of "f 16".

Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Sep 08, 2010 11:19 am     Reply with quote

That limit is for 16F. For 18F it's 31 stack levels.
dcm684



Joined: 08 Sep 2010
Posts: 8

View user's profile Send private message

PostPosted: Wed Sep 08, 2010 11:42 am     Reply with quote

PCM programmer wrote:
That limit is for 16F. For 18F it's 31 stack levels.

Okay. I am using an 18f chip. So it looks like the stack is not the cause of those other problems.

Thanks.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group