Next: Commenting, Tracing, and Documenting Code
Optimizing and Packaging Code
Using Embedded Coder, you can control function boundaries, preserve expressions, and apply optimizations on multiple blocks to further reduce code size. Data is exchanged with the generated code via global variables or function arguments. You can trace the generated code to blocks and signals in your model.
Embedded Coder options for generating code from MATLAB code and Simulink models enable you to:
- Generate processor-specific code for math functions and operators
- Reuse code for exporting to legacy or external environments
- Eliminate unnecessary initialization, termination, logging, and error-handling code
- Remove floating-point code from integer-only applications
Additional Embedded Coder optimization and configuration options are available for Simulink models, enabling you to:
- Generate code variants using macros for preprocessor compilation from models
- Store Boolean data and Stateflow states in bitsets
- Control the format of each generated file
- Determine how global data is defined and referenced
- Specify the contents and placement of comments
MATLAB example (left) and Simulink example (right) of target-specific math extensions and reusable function optimizations. Embedded Coder improves code efficiency by using target-specific and portable code optimizations.