Jump to content

Recommended Posts

Can I receive some advice on interpreting the Call Stack window in BoostC. I am receiving a Serious Warning and I want to work out where the Call Stack is too deep.

 

Thanks

 

TF

 

You need to see the call tree.

There are two ways of doing this,

either open the text file generated by Sourceboost in your project directory named after your project with the suffix "tree"

or

open the tree browser in the Sourceboost IDE. select Menu->View->Code Bar

In the Code Bar window select the call tree tab.

Link to post
Share on other sites
Can I receive some advice on interpreting the Call Stack window in BoostC. I am receiving a Serious Warning and I want to work out where the Call Stack is too deep.

 

Thanks

 

TF

 

You need to see the call tree.

There are two ways of doing this,

either open the text file generated by Sourceboost in your project directory named after your project with the suffix "tree"

or

open the tree browser in the Sourceboost IDE. select Menu->View->Code Bar

In the Code Bar window select the call tree tab.

 

Thanks

 

I can see the Tree - how do I spot where the stack is too deep? Which lines or +/- boxes are significant?

 

TF

Link to post
Share on other sites
Thanks

 

I can see the Tree - how do I spot where the stack is too deep? Which lines or +/- boxes are significant?

 

TF

 

It depends on the PIC you use, most PIC16 have a stack depth of 8, a few have a depth of 2, most PIC18 have a depth of 31.

 

If you click on a + box it opens up to show further branches, Im guessing that any function names in red are causing the problems.

 

Be aware that using interrupts reduces the available stack depth, calling functions in interrupts reduces further.

 

There is another solution, BoostC (from I think version 6.50) can implement a software stack.

See page 22 of the BoostC manual about linker option -swcs.

Link to post
Share on other sites
Thanks

 

I can see the Tree - how do I spot where the stack is too deep? Which lines or +/- boxes are significant?

 

TF

 

It depends on the PIC you use, most PIC16 have a stack depth of 8, a few have a depth of 2, most PIC18 have a depth of 31.

 

If you click on a + box it opens up to show further branches, Im guessing that any function names in red are causing the problems.

 

Be aware that using interrupts reduces the available stack depth, calling functions in interrupts reduces further.

 

There is another solution, BoostC (from I think version 6.50) can implement a software stack.

See page 22 of the BoostC manual about linker option -swcs.

 

Using -swcs 6 2 as a link option does 'solve' the problem.

 

There are no coloured function names - using v 6.60

 

Do you mean that I count down each +/- box to get the call stack count - if I reach a count of 7 (or is it 5 )then that is too deep?

 

( using interrupts for UART on 16F877A )

 

Thanks

 

TF

Link to post
Share on other sites

TF,

Using -swcs 6 2 as a link option does 'solve' the problem.

 

There are no coloured function names - using v 6.60

 

Do you mean that I count down each +/- box to get the call stack count - if I reach a count of 7 (or is it 5 )then that is too deep?

 

( using interrupts for UART on 16F877A )

You will get a serious warning if the total stack depth is > 8 on the PIC16F877A. The warning means the stack used depth by the main code and the interrupt code together exceeds 8. The code may function correctly if the main code uses a stack depth of 8 while interrupts are disabled, hence its is only a warning.

 

The call tree does give some clues, it highlights in red when the stack depth exceeds 8. But it does not show anything (as it does not know) if the possible sum of the main stack depth and interrupt stack depth exceed 8.

 

Regards

Dave

Link to post
Share on other sites
TF,
Using -swcs 6 2 as a link option does 'solve' the problem.

 

There are no coloured function names - using v 6.60

 

Do you mean that I count down each +/- box to get the call stack count - if I reach a count of 7 (or is it 5 )then that is too deep?

 

( using interrupts for UART on 16F877A )

You will get a serious warning if the total stack depth is > 8 on the PIC16F877A. The warning means the stack used depth by the main code and the interrupt code together exceeds 8. The code may function correctly if the main code uses a stack depth of 8 while interrupts are disabled, hence its is only a warning.

 

The call tree does give some clues, it highlights in red when the stack depth exceeds 8. But it does not show anything (as it does not know) if the possible sum of the main stack depth and interrupt stack depth exceed 8.

 

Regards

Dave

 

Thanks

 

I have no RED highlights showing but do have the Serious Warning as in the following:

 

Building...

BoostC Optimizing C Compiler Version 6.60 (for PIC16 architecture)

http://www.sourceboost.com

Copyright© 2004-2006 Pavel Baranov

Copyright© 2004-2006 David Hobday

 

...

 

Building CASM file

Serious Warning: Call stack usage exceeds:8!

 

Call Stack Usage Report

=======================

main and Task(s): hw used:7, exceeded by:0

interrupt: hw used:2, exceeded by:0

 

Memory Usage Report

===================

RAM available:368 bytes, used:357 bytes (97.1%), free:11 bytes (2.9%),

Heap size:11 bytes, Heap max single alloc:10 bytes

ROM available:8192 words, used:5762 words (70.4%), free:2430 words (29.6%)

Link to post
Share on other sites
The call tree does give some clues, it highlights in red when the stack depth exceeds 8. But it does not show anything (as it does not know) if the possible sum of the main stack depth and interrupt stack depth exceed 8.

 

Regards

Dave

 

 

The tree window does not seem to tailor itself to the processor in use. I am using a PIC18 and the tree shows all functions below 8 deep in red. I was rather curious as to why they were red, it wasnt until TF's question that I realised why.

Edited by Picxie
Link to post
Share on other sites
Call Stack Usage Report

=======================

main and Task(s): hw used:7, exceeded by:0

interrupt: hw used:2, exceeded by:0

 

Theres your problem, imagine you are in main and are in the function that is seven deep, if an interrupt occurs the stack will be full, when th interrupt calls its function the stack will overflow.

 

You may have a hidden function call in your interrupt, sourceboost uses built in functions to perform tasks such as multiplication or accessing data from an array in codespace.

Link to post
Share on other sites

Picxie,

The tree window does not seem to tailor itself to the processor in use. I am using a PIC18 and the tree shows all functions below 8 deep in red. I was rather curious as to why they were red, it wasnt until TF's question that I realised why.
This is not quite as it should be, another one for the improvements list :unsure:

 

Regards

Dave

Link to post
Share on other sites
Picxie,
The tree window does not seem to tailor itself to the processor in use. I am using a PIC18 and the tree shows all functions below 8 deep in red. I was rather curious as to why they were red, it wasnt until TF's question that I realised why.
This is not quite as it should be, another one for the improvements list :unsure:

 

Regards

Dave

Perhaps it's an idea to color the depth's which MIGHT be used by the interrupt with another color (blue?). Then you can easily see which functions might be at risk and need attention.

 

E.g. for PIC16:

Main hw: 9

Interrupt hw: 2

 

Level 7 and 8: Blue (or another color)

Level 9 and deeper: Red

 

Regards,

Mark

Link to post
Share on other sites
Picxie,
The tree window does not seem to tailor itself to the processor in use. I am using a PIC18 and the tree shows all functions below 8 deep in red. I was rather curious as to why they were red, it wasnt until TF's question that I realised why.
This is not quite as it should be, another one for the improvements list :unsure:

 

Regards

Dave

Perhaps it's an idea to color the depth's which MIGHT be used by the interrupt with another color (blue?). Then you can easily see which functions might be at risk and need attention.

 

E.g. for PIC16:

Main hw: 9

Interrupt hw: 2

 

Level 7 and 8: Blue (or another color)

Level 9 and deeper: Red

 

Regards,

Mark

 

At the moment I don't have colour in my stack window - is there something i need to turn on/

 

TF

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