Is it possible to get a worst case stack size with polyspace
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Anirban Gangopadhyay
2017-4-21
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.
更多回答(2 个)
Harry Immler
2018-9-18
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 个评论
Anirban
2018-12-13
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polyspace Code Prover 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!