Is it possible to get a worst case stack size with polyspace
2 views (last 30 days)
Show older comments
Hello everybody,
i would like to know a worst case value of stack usage for my embedded application. Is this information somehow avaliable with polyspace?
thanks
Olaf
0 Comments
Accepted Answer
Anirban Gangopadhyay
on 21 Apr 2017
From R2016b onwards, you can see the size of local variables in each function. You can estimate the stack usage by adding those sizes over your call hierarchy.
More Answers (2)
Harry Immler
on 18 Sep 2018
Hi,
in my case the embedded project has around 200 000 lines of code, and the call hierarchy is not predictable/traceable any more. Is there an option to enable stack size calculation to get the maximum/minimum needed stack size (maybe including possible interrupt processing)?
In the developer report it says the following:
Program Maximum Stack Usage: Not computed
Program Minimum Stack Usage: Not computed
Thank you for your support!
Kind regards, Harry
0 Comments
Anirban
on 13 Dec 2018
From R2017b onwards, Code Prover provides the stack size by tracing the call hierarchy.
See:
If the stack size usage of a function is not computed, there are two common reasons:
- The function or its callee contains a red check (definite run-time error). You should probably fix the error.
- The function or its callee contains a call to a recursive function. Use of recursive functions are generally discouraged in embedded software. For instance, MISRA C:2012 Rule 17.2 forbids use of direct or indirect recursions. To spot places where recursion is used, turn on the Polyspace checker for MISRA C:2012 Rule 17.2 and see the results. See Check for Coding Rule Violations.
If there are no red checks or recursive functions, there could be other far less common reasons why a stack size is not computed. To investigate the specific situation in your code, call MathWorks Customer Support: https://www.mathworks.com/support/contact_us.html .
0 Comments
See Also
Categories
Find more on Generate Report in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!