Source Code Generation
Generate and verify source code modules for function deployment and
integration
Learn how to initiate source code generation and learn about the files and folders that the code generator produces. To organize large projects, use the code generation project template. Projects help you find required files, manage and share files and settings, interact with source control, generate controller code, and run test harness simulations.
You can start with Generate Code by Using the Quick Start Tool.
Apps
Embedded Coder | Generate readable, compact, and fast C and C++ code for embedded processors used in mass production |
Functions
Topics
Generate Code
- 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. - Generate Code Using Embedded Coder
Select a target for a Simulink® model, configure options, generate C code for embedded systems, and view generated files. - Internationalization and Code Generation
Internationalization support for enabling efficient globalization. - What Is Code Replacement?
Why and how to replace code. Code replacement libraries that MathWorks provides. Contents of a code replacement library and how the code generator uses the contents. Terminology and limitations. - 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.
Code Generation with Project
- Generate Code and Simulate Models in a Project
This example shows how to use the code generation template for a new Project. - Generate Code and Simulate Models Programmatically with Project
This example shows how to use the Project API to create a new project and automate project tasks for manipulating files.
Code Generation Files and Folders
- Manage Build Process Folders
Manage folders that the code generator creates. - Manage Build Process Files
Work with generated source files and dependency files that the code generator produces. - 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.
Embedded System Code Generation Tutorial
- 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.
- STEP 1: Prepare a Control Algorithm Model for C Code Generation
- STEP 2: Configure Data Interface in the Generated Code
- STEP 3: Partition Functions in Generated Code
- STEP 4: Call External C Code from Model and Generated Code
- STEP 5: Build Integrated Code Outside the Simulink Environment
- STEP 6: Test Generated Code
- STEP 7: Evaluate Performance of the Generated Code
- STEP 8: Install and Use Cygwin and Eclipse