This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMS320F280049C: Problem with stack size

Part Number: TMS320F280049C
Other Parts Discussed in Thread: STRIKE

Tool/software: TI C/C++ Compiler

I am working on TMS320F280049C DSP. I was analyzing the stack size of different functions using the stack usage view. I am attaching a screenshot of it. ADCAISR has occupied maximum memory storage 40 bytes. How can I increase that size to avoid stack overflow. Why that 40 bytes are fixed for all functions?

  • Chirag,

    The stack usage view is a static analysis of each functions stack usage.  I believe the Exclusive Size is what the particular function itself uses, and the Inclusive Size is what the particular function plus any nested functions that it calls use.  Interrupts are not included in the Inclusive Size, as the static analysis does not know when an interrupt might strike.  For C2000 devices, the size shown is in 16-bit words, not bytes.

    In your case, ADCA1ISR is statically using 40 words.  The yellow is supposed to mean its usage is near the stack size, but I'm finding that the graph always shows the largest bar as yellow regardless of the stack size.  Your stack is probably much larger than 40 words.  Stack size is specified in the project properties -> C2000 linker  -> Basic Options.  A blank box defaults the stack to 0x400 words.

    Regards,

    David

  • David M. Alter said:
    the Exclusive Size is what the particular function itself uses, and the Inclusive Size is what the particular function plus any nested functions that it calls use.

    That is correct.

    Thanks and regards,

    -George

  • It is showing stack size in bytes. I have attached sc. It's limited by 40 bytes. Is there any tool to view dynamic memory allocation while debugging with JTAG or running standalone.

    Regards

    Chirag

  • Chirag,

    The hover text on the stack graph may be saying bytes, but the values shown are in 16-bit words.  Here is an example showing adcA1ISR exclusive stack usage of 26 words:

    Here is the same project after I declared a 100 16-bit word local array in adcA1ISR().  Local vars live on the stack.

    You can see that the adcA1ISR() stack usage increased by exactly 100 16-bit words.

    Also, the hover text isn't showing percentage of maximum stack usage.  I'm not sure exactly what it is showing.  It appears to be taking the largest stack user and using that as the maximum stack size and then showing percentage of usage of that.  This is not the maximum stack size.  Stack size is specified in the project properties on C2000 Linker->Basic Options.

    Above, my project has a stack size of 0x200 16-bit words.

    There is no dynamic stack usage viewer in the tools.  What you can do is fill the stack with a known value (e.g., 0xdead) during init, and then run the code for a while.  Halt it, and then examine the stack usage.

    Regards,

    David

  • David,

    You are right, I increased the size of the function and It increase the size in words, not in the bytes.

    Thanks.