Products & Services Solutions Academia Support User Community Company

Learn more about Real-Time Workshop   

Integration Options

Introduction

The Real-Time Workshop product includes a variety of approaches for integrating legacy or custom (external) code with generated code. Legacy code is existing C or C++ hand code or code for environments that needs to be integrated with code generated by the Real-Time Workshop software. Custom code can be legacy code or any other user-specified lines of code that need to be included in the Real-Time Workshop build process. Collectively, legacy and custom code are called external code.

You can achieve code integration from either of two contexts. You can integrate

Block-Based Integration

The following table lists available block-based integration mechanisms based on application requirements. The table also provides information on where to find details on how to apply each mechanism.

If You Need or Prefer to...Consider Using...For Details, See...
  • Simulate and generate code such that block behavior is the same or unique for the two environments.

  • Develop a complete interface to all Simulink block functions, block memory, and block capabilities.

  • Use input and output ports for interaction between and placement with respect to other blocks.

  • Use Simulink parameters (for example, run-time parameters).

  • Apply code generation optimizations, such as expression folding and the use of local block output ports.

  • Add file and path information for existing code into the Real-Time Workshop build process. An extensive, block-based rtwmakecfg API is available.

  • Control the location of generated code through block placement.

  • Use TLC library functions for the block or overall model code.

  • Maximize ease-of-use for model designers.

User written S-Function blocks

  • Use a graphical user interface to create S-Function blocks.

  • Specify build information through a graphical user interface.

S-Function Builder block

Information on the S-Function Builder block in the Simulink documentation

  • Not affect simulation or simulation-based targets, such as S-function targets, accelerated simulation targets, and model reference simulation targets.

  • Insert lines of code into functions at the atomic system or model level.

  • Minimize development effort by just typing in lines of custom code.

Real-Time Workshop Custom Code blocks

Integrating External Code Using Custom Code Blocks

S-Function blocks offer the most capable and flexible means of integrating code and specifying additional build information. Their use in a model carries the build information as well.

Model or Target-Based Integration

The following table lists available model or target-based integration mechanisms based on application requirements. The table also provides information on where to find details on how to apply each mechanism.

If You Need or Prefer to...Consider Using...For Details, See...
  • Not affect simulation or simulation-based targets, such as S-function targets, accelerated simulation targets, and model reference simulation targets.

  • Add lines of custom code in the generated model header or source file.

  • Add lines of custom code to generated initialization and termination functions.

  • Specify the files and path to be used for the Real-Time Workshop build process.

  • Minimize development effort by just typing in lines of custom code, paths, or filenames.

  • Use a modeling approach; include model information as configuration parameters.

Custom Code pane of the Configuration Parameters dialog box

Building Executables

  • Use a mechanism that affects all model builds for a given target — model and block independent.

  • Include paths, source file rules, and libraries in the makefile.

  • Control the build process by selecting a custom Real-Time Workshop system target file.

Custom target template makefile

Real-Time Workshop Embedded Coder documentation — details on makefiles

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS