MATLAB Answers

0

Is it possible to get a worst case stack size with polyspace

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

로그인 to comment.

답변 수: 3

Answer by Anirban Gangopadhyay on 21 Apr 2017
 Accepted Answer

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.

  댓글 수: 1

Thanks.
Great to see that also these old questions are reviewed.

로그인 to comment.


Answer by 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

로그인 to comment.


Answer by 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

로그인 to comment.



Translated by