MATLAB Answers

Polyspace code prover not able to analyse stack for whole project

3 views (last 30 days)
ashwini BHAT
ashwini BHAT on 3 Dec 2020
Commented: Anirban on 5 Jan 2021
Trying to get stack size for my project but code prover is giving only application level with initialization value.
Let me know how to get entire stack usage value for whole project with both application and bootloader.

Accepted Answer

Anirban on 4 Dec 2020
Could you provide some more information? For instance, the following would be helpful:
  • When you say 'project', do you mean a Polyspace project? Are the bootloader source files part of the Polyspace project?
  • How do you know that the stack size estimation is not taking the bootloader sources into account?
Just for your information, the software does compute a Program Maximum Stack Usage . In some situations, the result for this metric might show up as Not Computed. Is that what is happening here?
Whatever else you can state about your diagnosis of the problem can help us here.
Anirban on 5 Jan 2021
Gray checks should not prevent computation of program maximum stack usage. The function calls in gray code would simply be discounted from the computation.
The things that prevent stack usage computation are things that you would typically not have in your code:
  • Red checks
  • Infinite loops (These sometimes appear as Non-terminating loop red checks, but for trivial infinite loops that are perhaps intended, the loops are shown through a dashed red in the source code. )
  • Recursive functions (In embedded code, recursive functions are discouraged. You can run the checker for MISRA C:2012 Rule 17.2 to detect these functions.)
If the stack usage of a function appears as Not computed, the stack usage of all functions upstream from this function will probably also appear as Not computed. One quick question comes to mind. Do you have a main function in your project or are you using the Polyspace option -main-generator?

Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!

Translated by