Can anyone tell me how polyspace_main file is generated and works?

1 vue (au cours des 30 derniers jours)
Pallavi Ingole
Pallavi Ingole le 26 Oct 2016
Commenté : Rajeev le 19 Fév 2021
I found that if we don't include main file while using polyspace, it creates its own _polyspace_main file. Can anyone tell me, how it get created? what it takes into consideration? how it decides sequence of function calling as main is missing?
  1 commentaire
Rajeev
Rajeev le 19 Fév 2021
Hello Alex,
Is it possible to view the generated _polyspace_main file?

Connectez-vous pour commenter.

Réponse acceptée

Alexandre De Barros
Alexandre De Barros le 28 Oct 2016
Hello,
When there is no main, Polyspace considers that the provided code represents an incomplete application. Hence, by default:
  1. the global variables (except the static ones) are treated like they could also be accessed by functions/methods that are not present,
  2. the functions that are not called in the provided code will be called by the generated main.
The main generator will then create a main that will make the global and non-static variables "full range" (i.e. all the values of their type are considered), and that will call the uncalled functions, in any order.
By doing this, the main generator is conservative, so no potential bug is missed.
This default behavior can be tuned, and users can tell how the main generator will treat the global variables, which functions should be called, if an init function should be called before the others, etc...
More information on the way the main is created and the related options can be found here.
Alex

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Coder dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by