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.

CCSV5 TIVA-C Peak Stack Usage in a NON-RTOS environment

CCS Version: 5.5.0.00077; Tiva-C TM4C123G; No RTOS. TivaWare_C_Series-2.0.1.11577

Is there a way to write a script / function that will execute when a memory write to watchpoint (__stack in my case) is triggered such that I can detect the "peak" value written to the memory location?

I am trying to determine the peak usage of the stack in order to trim down the memory I have allocated to the stack.  I can't seem to determine how to calculate the correct size and I find myself over allocating in order to guard against erratic program behavior.

  • Stephen Killingsworth said:
    I am trying to determine the peak usage of the stack in order to trim down the memory I have allocated to the stack.

    Have you seen Finding out static stack usage?

  • Thank you - I have not seen this.  Thank you. 

    Very informative.  Does look like these tools can help set a static size.  I appreciate the point of view it presents w/r/t risks of attempting to resolve a "dynamic" stack limit.   I will look into using these tools.

    While your input has given me an solution to the stack portion of my query, the other part of my question still remains as a general point of interest. 

    Can a watch-point have a function or script attached to perform tasks when the watch-point is triggered on memory location read or write?

  • Stephen Killingsworth said:

    Can a watch-point have a function or script attached to perform tasks when the watch-point is triggered on memory location read or write?

    You could look into Debug Server Scripting (DSS). More information on DSS is here:
    http://processors.wiki.ti.com/index.php/Debug_Server_Scripting

    Setting and using watchpoints using DSS can be a bit tricky because there isn't a single API that can apply a watchpoint (since the watchpoint capabilities differ from target to target). There is an example script though that ships with CCS that sets up a watchpoint on an msp430 located here:
    <install>\ccsv5\ccs_base\scripting\examples\DebugServerExamples\Watchpoints.js. 
    The properties would differ for other devices, but that might at least give you an idea on how the APIs work, and if that would be suitable for your requirements or not.