Real Time Workshop - variables initialization
1 回表示 (過去 30 日間)
古いコメントを表示
For Simumink blocks with an internal state (such as as unit delay, discrete time integrator, etc ...) the code generated for initialization differs depending on the numerical value of the initial conditions. If the initial condition is zero no initialization code is produced, while if it is not zero some initialization code is produced. Why ? This may cause troubles if the used C compiler does not force zero initialization. In such a case random initialized variables may occur.
0 件のコメント
採用された回答
MarkB
2011 年 1 月 31 日
The "Optimization" section of the "Configuration Parameters" has several optimizations related to removing zero initializations. If you disable these optimizations, it should generate initialization code consistently, regardless of which numeric values are used.
With the optimizations enabled, most initialization code is removed, except for non-zero values, or initializations that occur in "conditionally-executed subsystems" (e.g. enabled subsystems). The general idea is that many embedded systems zero-out RAM at power-on, making explicit zero-initialization redundant. However, these conditionally-executed subsystems may need to be reset independently of a power-on condition meaning that they are not redundant.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!