Get the maximum number of bytes used by the stack since power on (or reset).
None (Main library). (See Section 2.3, “Licensed Features”.)
Gets the number of bytes used by the application model and platform library since the ECU was last powered on (or reset). The stack is shared area of RAM used to store temporary information, such as calculations and function call parameters.
The total stack size allocated to the application model and platform library can be adjusted through the RTW options, see System stack size. It is important to allocate sufficient stack space for the worst case function call tree through the application and platform code otherwise the ECU may not behave as expected. While developing a model, keep a track of the stack size used and, as the usage grows, grow the system stack size appropriately.
The ECUs are configured by the platform software to reset when the stack overflows its allocation. The reset prevents the ECU from behaving unexpectedly.
When using RTW as the model auto-coder, be aware that RTW has two ways of allocating model data.
RTW can statically allocate the data, which means that the model data is allocated to a fixed address in memory and not to the stack. This form of allocation is preferred because at run time the stack usage will be low, and if the model becomes too large for the ECU's memory, the model will fail to build completely.
Unselect the RTW Enable local block outputs option to have RTW statically allocate model data.
RTW can dynamically allocate the data to the stack. This means that the stack use can vary significantly at run time and the system stack size will need to be larger. This form of allocation is not preferred because to guarantee that the stack will not overflow will require detailed analysis of the RTW generated code.
Select the RTW Enable local block outputs option to have RTW dynamically allocate model data to the stack.
Only used under simulation and when the parameter Provide simulation inputs is ticked. The outport used_bytes is set to the value of this inport for simulation purposes.
Range: 0 to system stack size specified in System stack size.
The number of used bytes from the system stack size since the ECU was powered on (or reset). Under simulation, if the Provide simulation inputs parameter isn't ticked, the outport is set to the minimum of its range.
Range: 0 to system stack size specified in System stack size.
The periodicity of the block execution.
Range: [0.001, 3600] seconds
Value type: | Real | ||
Calibratable: | No |
Tick to enable inport sim_used_bytes.