源代码生成
为函数部署和集成生成和验证源代码模块
了解如何启动源代码生成以及代码生成器生成的文件和文件夹。要组织大型工程,请使用代码生成工程模板。通过工程,您可以找到所需的文件,管理和共享文件和设置,与源代码管理进行交互,生成控制器代码,以及运行测试框架仿真。
App
Embedded Coder | 为大规模生产中使用的嵌入式处理器生成可读、紧凑且快速的 C 和 C++ 代码 |
函数
主题
生成代码
- Generate Code by Using the Quick Start Tool
Prepare a model for quickly generating readable, efficient code. - Increase Code Generation Speed
Alter a model to increase the speed at which the code generator generates code. - 使用 Embedded Coder 生成代码
为 Simulink® 模型选择目标、配置选项、为嵌入式系统生成 C 代码,以及查看生成的文件。 - 国际化和代码生成
支持高效全球化的国际化支持。 - 什么是代码替换?
为什么以及如何替换代码。MathWorks 提供的代码替换库。代码替换库的内容以及代码生成器如何使用这些内容。术语和限制。 - Configure a Code Replacement Library
Explore available code replacement libraries and library content to find a suitable match for your code requirements. - Configure Model for Debugging
Configure a model so that generated code and the build process are set for debugging. - Reload Generated Code
Reload generated code from the Model Explorer.
通过工程进行代码生成
- 在工程中生成代码并进行模型仿真
此示例说明如何使用代码生成模板创建新的工程。Simulink 工程的代码生成工程模板包含多个模型。工程模板还提供可帮助您生成控制器代码并运行框架模型仿真的实用工具(.m 脚本)。 - 使用工程以编程方式生成代码和仿真模型
以下示例说明如何使用工程 API 创建新工程,并自动执行工程任务来操作文件。它讲述如何以编程方式创建空白工程、添加文件和文件夹、设置工程路径、定义工程快捷方式、生成代码以及对框架模型进行仿真。
代码生成文件和文件夹
- 管理编译过程文件夹
管理代码生成器创建的文件夹。 - 管理编译过程文件
使用生成的源文件和代码生成器生成的依赖项文件。 - Manage Build Process File Dependencies
Work with generated source files and dependency files that the code generator produces. - Build Process Support for File and Folder Names
Troubleshoot build process errors that occur when file system issues prevent file processing. - Manage File Packaging of Generated Code Modules
Generate code modules and header files with the code generator.
嵌入式系统代码生成教程
- Tutorial for Generating C Code from a Control Algorithm for an Embedded System
This guided tutorial shows how to generate code for a control algorithm model, integrate the generated code with an existing system, and validate simulation and executable results.
- 步骤 1: 为 C 代码生成准备控制算法模型
- 步骤 2: 配置生成的代码中的数据接口
- 步骤 3: 在生成的代码中进行函数划分
- 步骤 4: 从模型和生成的代码调用外部 C 代码
- 步骤 5: 在 Simulink 环境之外编译集成的代码
- 步骤 6: 测试生成的代码
- 步骤 7: 评估生成的代码的性能
- 步骤 8: 安装和使用 Cygwin 及 Eclipse