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.
|1||Review your assessment of external code characteristics and integration requirements.||Choose an External Code Integration Workflow (Embedded Coder)|
|2||Define the representation of model data for code generation.||Exchange Data Between External C/C++ Code and Simulink Model or Generated Code (Embedded Coder)|
|3||Generate S-function and TLC files by using the Legacy Code Tool. If necessary, refine the generated code manually to meet application requirements.|
|4||Verify algorithm behavior and performance by simulating the model.||Simulation|
|5||Configure the model for code generation.||Generate Code That Matches Appearance of External Code (Embedded Coder) and Model Configuration (Embedded Coder)|
|6||Generate code and a code generation report.||Code Generation (Embedded Coder)|
|7||Review the generated code interface and static code metrics.||Analyze the Generated Code Interface (Embedded Coder) and Static Code Metrics (Embedded Coder)|
|8||Build an executable program from the model.||Build Integrated Code Within the Simulink Environment (Embedded Coder)|
|9||Verify that executable program behaves and performs as expected.||Numerical Equivalence Testing (Embedded Coder)|
|10||Verify that executable program performs as expected.||Code Execution Profiling (Embedded Coder)|