Main Content

Troubleshoot Overloaded CPU from Executing Real-Time Application

Some issue is producing a CPU overload when executing a real-time application.

What This Issue Means

A CPU overload indicates that the CPU is unable to complete processing a model time step before restarting for the next time step.

When this error occurs, the Simulink Real-Time RTOS halts model execution and the Target object property TargetStatus shows an error, for example:

mCPUOverload: Sub-rate exception: Overload limit (0) exceeded in 0.02s rate with 1 overloads

If you allow the overload, model execution continues until the allowed overload limit is reached. If the model continues to run after a CPU overload, the time step lasts as long as the time required to finish the execution. This behavior delays the next time step.

Model design or target computer resources cause CPU overloads. Possible reasons are:

  • The target computer is too slow or the model sample time is too small.

  • The model is too complex (algorithmic complexity).

  • I/O latency, where each I/O channel used introduces latency into the system. I/O latency can cause the execution time to exceed the model time step.

    To find latency values for Speedgoat boards, see and select Products & Services > Services.

Try This Workaround

The Simulink® Real-Time™ RTOS usually halts model execution when it encounters a CPU overload. You can configure the Simulink Real-Time model to allow CPU overloads. Use this capability to support long initializations and for overload diagnosis. You also can try to reduce overloads by improving application performance and enabling the Compile with GCC -ffast-math option.

Permit Long Initialization Time

For some real-time applications, normal initialization can extend beyond the first sample time. Use the SLRT Overload Options block to increase the number of startup time steps to ignore overloads. By default, only the first time step ignores overloads.


Allowing the target computer CPU to overload can cause incorrect results, especially for multirate models. Use the SLRT Overload Options block only for diagnosis. When your diagnosis is complete, turn off these options.

Enable Compile with GCC -ffast-math Option

The Compile with GCC -ffast-math option enables the GCC compiler -ffast-math option when compiling real-time application code. This option is disabled by default for Simulink Real-Time models.

By enabling the Compile with GCC -ffast-math option, you provide the compiler with more flexibility to optimize floating-point math at the expense of deviating from the IEEE-754 floating-point standard.

For more information about the -ffast-math option, see the Semantics of Floating-Point Math in GCC and

Force Polling Mode

The Force polling mode option enables polling mode — instead of interrupt-driven mode — for clocking the real-time application. Enabling this option can help reduce CPU overloads if:

  • The target computer has at least four CPU cores.

  • The CPU overload is caused by sporadic TET spikes.

See Also

Related Examples

More About

External Websites