Main Content

Call External Device Drivers

Device drivers for protocols and target hardware are essential to many real-time development projects. For example, you can have a working device driver that you want to integrate with algorithmic code that has to read data from and write data to the I/O device that the driver supports. The code generator can produce a single set of application source files from an algorithm model and integrated driver code written in C or C++.

To call external device driver code from the Simulink® environment, iterate through the tasks in this table.

TaskActionMore Information
1Review your assessment of external code characteristics and integration requirements.

Choose an External Code Integration Workflow

2Define the representation of model data for code generation.

Exchange Data Between External C/C++ Code and Simulink Model or Generated Code

3Generate S-function and TLC files by using the Legacy Code Tool. If necessary, refine the generated code manually to meet application requirements.
4Verify algorithm behavior and performance by simulating the model.


5Configure the model for code generation.

Model Configuration Set Customization

6Generate code and a code generation report.

Code Generation

7Review the generated code interface and static code metrics.

Analyze Generated Data Code Interface Report and Static Code Metrics

8Build an executable program from the model.

Build Integrated Code Within the Simulink Environment

9Verify that executable program behaves and performs as expected.

Verification, Testing, and Certification

Related Topics