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

3 vues (au cours des 30 derniers jours)
Olaf
Olaf le 11 Sep 2013
Réponse apportée : Anirban le 13 Déc 2018
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

Réponse acceptée

Anirban Gangopadhyay
Anirban Gangopadhyay le 21 Avr 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.
  1 commentaire
Olaf
Olaf le 25 Avr 2017
Modifié(e) : Olaf le 25 Avr 2017
Thanks.
Great to see that also these old questions are reviewed.

Connectez-vous pour commenter.

Plus de réponses (2)

Harry Immler
Harry Immler le 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

Anirban
Anirban le 13 Déc 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 .

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by