可调用函数集成
将从 Simulink 函数生成的可调用入口函数与平台调度软件集成
一个 Embedded Coder® 部署选项是生成源代码模块,用于与特定于平台的函数调度器和其他平台中间件集成。要集成代码,请考虑数据因素,例如:
导入具有条件编译维度的参数数据。
在生成的代码和外部代码之间交换结构化或枚举数据。
替换或重命名数据类型以符合编码标准。
另一种选择是生成可以集成到外部代码库中的共享库。
主题
源代码
- 生成要导出到外部代码库的组件源代码
将从模型组件生成的 C/C++ 源代码与在 Simulink® 环境之外开发的代码集成在一起。 - Generate Code That Matches Appearance of External Code
Configure how the code generator applies identifiers (symbols), comments, code styles, code format, and organization. - Integrate External Application Code with Code Generated from PID Controller
Generate code that matches the data interfaces, appearance, and organization of external code. - 生成主程序以部署到裸机目标硬件
配置用于生成示例主程序的模型。 - Deploy Generated Component Software to Application Target Platforms
Run an executable program with a target support package for Linux®, Microsoft® Windows®, or Wind River® VxWorks® operating systems. - Deploy Applications to Target Hardware
Generate application code that includes an example main program and scheduler.
共享库
- Generate Shared Library for Export to External Code Base
Build a shared library from a model component and export the library to an application for system simulation, software reuse, or intellectual property protection. Requires an Embedded Coder license. - 通过使用共享库对接在开发计算机上运行的仿真器
生成可以动态加载到其他应用程序中的共享库。 - 将 S-Function 目标用于模型或子系统
使用从模型或子系统中生成的可以动态加载到其他应用程序中的共享库。
数据考虑因素
- Access Structured Data Through a Pointer That External Code Defines
Generate code that accesses parameter data through a structure pointer that handwritten code defines. - Import Parameter Data with Conditionally Compiled Dimension Length
Generate code that imports an array parameter whose dimension lengths your external code sets with macros (#define
). - Reuse Parameter Data from External Code in the Generated Code
Generate code that imports parameter data from your external code. - Exchange Structured and Enumerated Data Between Generated and External Code
Generate code that you can compile together with existing, external code. The bodies of code exchange structured and enumerated data. - Exchange Data Between External C/C++ Code and Simulink Model or Generated Code
Configure the signals, states, and parameters in a Simulink model to match the data interface of your existing C code. - Exchange Data Between External Calling Code and Generated Code
When you export the generated code into your external code, exchange signal, state, and parameter data. - Replace and Rename Simulink Coder Data Types to Conform to Coding Standards
Conform to the coding standards of your organization by replacing and renaming the Simulink Coder™ data type aliases, such asreal_T
, which the generated code uses to define data.
C++ 支持
- Generate C++ Class Interface to Model or Subsystem Code
Generate a C++ class interface to code generated from a model or subsystem. - Generate Code for String Blocks by Using the Standard C++ String Library
Generate C++ code for Simulink string blocks.