이 페이지는 기계 번역을 사용하여 번역되었습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.
C 데이터 및 함수 인터페이스
모델 데이터 요소 및 함수를 모델에 독립적인 코드 정의에 매핑합니다.
코드 표준 및 지침을 준수하고, 생성된 코드를 외부 코드와 통합하고, 메모리 요구 사항을 해결하고, 코드 생성을 위한 모델 데이터 요소와 진입점 함수의 표현을 구성합니다. 제품에서 미리 정의하거나 Embedded Coder 사전으로 만든 코드 정의에 매핑하여 모델 데이터 요소와 함수를 구성합니다. 데이터 요소의 경우 사용자 지정 스토리지 클래스 디자이너를 사용하여 패키지에서 생성된 코드 정의에 매핑하는 옵션도 있습니다.
이에 대한 소개는 C Data Code Interface Configuration for Model Interface Elements 항목을 참조하십시오.
툴
코드 매핑 편집기 – C | Associate model elements with code interface definitions |
객체
coder.mapping.api.CodeMapping | Model data and function interface configuration for C code generation |
coder.mapping.api.CoderDictionary | Query and set the code settings of dictionary defaults in an Embedded Coder dictionary within a Simulink data dictionary (R2021a 이후) |
함수
도움말 항목
구성 기본 사항
- C Data Code Interface Configuration for Model Interface Elements
Control the representation of model data elements and functions in generated C code by using a data code interface configuration. - Code Definition and Mapping Limitations and Considerations
Restrictions, constraints, and considerations that apply to code definitions and code mappings. - Configure Default C Code Generation for Categories of Data Elements and Functions
Apply default code generation configurations for categories of model data and functions across a model. - Manage Multiple Code Mappings for a Model
Design models that are platform-neutral and ready to deploy to different run-time environments. - Protect Global Data with const and volatile Type Qualifiers
Prevent data corruption and improve code safety by applying C type qualifiersconst
andvolatile
to global data in generated code. - How Generated Code Exchanges Data with an Environment
The generated code exchanges signal, state, and parameter data with the calling environment through a data interface. - Configure Generated Code According to Interface Control Document Specifications
Configure code generation settings for a model according to specifications from an interface control document. - Migration of Model Data Configurations to Code Mappings
How Simulink® migrates code definitions for models created before release R2020b to code mappings and related information to consider. - Migration of Memory Section and Shared Utility Settings from Configuration Parameters to Code Mappings
For models created before release R2018a, how Simulink migrates memory section and shared utility function configuration parameter settings to model code mappings for C code generation. - Compare Code Mappings of Simulink Models
Compare the mappings of models using the Simulink Comparison Tool.
C 데이터 구성
- Choose Data Configuration Approach
Make decisions about the design data used by your model based on your code generation requirements. - Configure Root-Level Inport Blocks for C Code Generation
Set the storage class and other relevant code generation properties for root-level Inport blocks. - Configure Root-Level Outport Blocks for C Code Generation
Set the storage class and other relevant code generation properties for root-level Outport blocks. - Configure Signal Data for C Code Generation
Set the storage class and other relevant code generation properties for signal data. - Configure Parameters for C Code Generation
Set the storage class and other relevant code generation properties for parameters. - Configure Block States for C Code Generation
Set the storage class and other relevant code generation properties for block states. - Configure Data Stores for C Code Generation
Set the storage class and other relevant code generation properties for data stores. - Choose Storage Class for Controlling Data Representation in Generated Code
Choose a storage class to apply to data elements in a model, such as signals, states, and block parameters. - Use Built-In and Predefined Storage Classes to Represent Data in Generated Code
Use built-in or predefined storage class to represent data based on their predefined and customizable properties. - Control Placement of Global Data Definitions and Declarations in Generated Files
Modularize the generated code and establish clear ownership of global data by controlling the file placement of each declaration and definition. - Design Data Interface by Configuring Inport and Outport Blocks
Customize the data interface of a model to enable integration of the generated code with your own code and to improve code traceability and readability.
C 함수 구성
- Configure Generated C Function Interface for Model Entry-Point Functions
Learn about generated C entry-point functions, configuration options, and how to interface with them. - Control Data and Function Interface in Generated Code
Control how generated code exchanges data with a calling environment. - Configure Entry-Point Function Interfaces for Simulink Function and Function Caller Blocks
Customize entry-point function names and step function arguments for Simulink Function and Function Caller blocks. - Generate Modular Function Code for Nonvirtual Subsystems
Generate modular function code for nonvirtual subsystems. - Rapid Prototyping Model Functions
Generate rapid prototyping code. - Control File Packaging of Generated Entry-Point Functions and Simulink Functions
This example shows how to specify custom filenames for entry-point functions and Simulink® functions using function customization templates.
데이터 액세스 및 초기화
- Create Tunable Calibration Parameter in the Generated Code
In the generated code, create tunable parameter data that you can access during rapid prototyping and calibration. - Reuse Parameter Data in Different Data Type Contexts
Reuse parameter data by creating aSimulink.Parameter
object or numeric MATLAB® variable that you can use in different data type contexts. - Limitations for Block Parameter Tunability in Generated Code
Limitations can prevent a block parameter from appearing in the generated code as tunable, which means you cannot interact with the parameter value after compiling the code. - Access Signal, State, and Parameter Data During Execution
As you iteratively develop a model, capture output signal and state data that model execution generates. Tune parameter values during execution to observe results on the outputs. - Switch Between Sets of Parameter Values During Simulation and Code Execution
Switch between independent sets of values for the same block parameters by storing the sets in an array of structures. - Preserve Variables in Generated Code
As you iteratively develop a model, you can tune block parameter values during simulation or execution of generated code to observe the results on signal and state values. - Configure Packaging of Parameter Arguments in Generated Code
Customize the implementation of parameter arguments in generated code. - Control Signal and State Initialization in the Generated Code
Generate code that enables you to store tunable initial conditions in memory, for example, for modeling a system that shuts down and restarts. - Initialization of Signal, State, and Parameter Data in the Generated Code
To match the numerics of a simulation in Simulink, the generated code assigns initial values to global data, especially for block states and parameters. - Compile Code Conditionally for All Values of Variant Parameters with Same and Different Dimensions
This example shows how to generate a C code that contains all the active and inactive values of variant parameters.