Jump to content

Recommended Posts

I have this warning.

 

Is there a simple way to determine where this problem occurs?

 

In the "call tree" window I can count a max depth 8 so apparantly there must be something else causing this...

 

Yes, this is a user malfunction i am sorry to say.

You need to read the datasheets for your specific device, under Memory Organization.

 

Most PICs only support a max depth of 7, every if, while, for, function call and interrupt instruction

goes down one level, if your exceeding this depth you really need to rethink your code.

 

Where this error usually bites you is when you call a poorly written function in an interrupt, the

interrupt itself counts as one, then you lose another level for the function call, this means you

only have 5 levels of depth left. If you are using if statements to test, this very quickly gets eaten

up.

 

Btw the stack levels can differ from class to class of PICs, seven is the average depth.

Link to post
Share on other sites

fred,

I have this warning.

 

Is there a simple way to determine where this problem occurs?

 

In the "call tree" window I can count a max depth 8 so apparantly there must be something else causing this...

If you can count a depth of 8 and you have an interrupt active you may be oveflowing the stack.

 

The interrupt serivce routine uses a stack depth of at least 1.

 

The "Call Stack Usage Exceeds 8" is only a warning because you could use a full stack depth of 8 when interrupts are disabled and then use a stack depth of 7 when interrupts are enabled.

 

Regards

Dave

Link to post
Share on other sites

I hadn't thought off interrupts and the 'hidden calls'

 

I made the whole interrupt handling as 'flat' as possible and translated some little functions into macro's.

 

Doing this all it's brought back to max 6 levels in the 'call tree' ;)

 

Unfortunately the code size has now increased so I might bump into problems here a bit later in my project probably. :P

Link to post
Share on other sites

fred

I hadn't thought off interrupts and the 'hidden calls'

 

I made the whole interrupt handling as 'flat' as possible  and translated some little functions into macro's.

 

Doing this all it's brought back to max 6 levels in the 'call tree'  ;)

 

Unfortunately the code size has now increased so I might bump into problems here a bit later in my project probably.  :P

You could consider using the software call stack linker option -swcs.

It allows unlimited call depth, but does use extra RAM and code for calling and returning from functions.

 

Regards

Dave

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...