이 페이지는 기계 번역을 사용하여 번역되었습니다. 영어 원문을 보려면 여기를 클릭하십시오.
메모리 사용량
R2026b생성 코드로 RAM, ROM, 스택 공간 사용을 최적화
코드 생성기가 변수를 지역 변수로 정의하는지 아니면 전역 변수로 정의하는지와 데이터가 서브시스템 함수로 어떻게 전달되는지를 지정하여 메모리 사용량을 제어합니다. 구성 설정을 수정하여 데이터 저장에 사용되는 메모리의 양을 줄입니다.
코드 생성기는 제어 흐름 구조를 결합하고, 쓸모없는 코드 경로와 계산 결과에 영향을 미치지 않는 블록에 대한 코드를 제거하여 ROM 사용량을 줄입니다. 초기화 코드, 재설정 및 비활성화 함수, 방어 코드 등 필요 없는 코드를 제거하면 ROM 사용량을 더욱 줄일 수 있습니다.
모델 설정
도움말 항목
메모리 사용량 최적화의 기초
- Design Techniques to Optimize Models for Efficient Code Generation
Apply design tools and techniques to optimize a model for code generation. - Optimize Generated Code Using Code Efficiency Tools and Techniques
When generating production code from your model to deploy into a real-time embedded system, code efficiency is an important consideration. - 코드 생성 어드바이저를 사용하여 코드 생성 목표에 맞게 모델 구성하기
코드 생성 어드바이저를 사용하여 모델이 코드 생성 목표에 부합하는지 확인하십시오. - Generate Efficient Code by Setting Model Configuration Parameters
Choose the efficiency level and priorities for your generated code.
변수를 로컬 또는 글로벌로 정의
- Customize Stack Space Allocation
Control the maximum allowable stack size to provide some control over whether data is defined locally or globally in the generated code. - Enable and Reuse Local Block Outputs in Generated Code
Where possible, the code generator declares block outputs as local variables, so that it can potentially reuse these variables. - Reuse Global Block Outputs in the Generated Code
The code generator attempts to reuse global variables. - Optimize Global Variable Usage
Choose a global variable reference optimization to satisfy your memory usage and execution speed requirements. - Optimize Generated Code by Passing Reusable Subsystem Outputs as Individual Arguments
The code generator eliminates data copies from local variables back to global block I/O structures by passing reusable subsystem outputs as individual arguments instead of as a pointer to a structure stored in global memory. - Reduce Global Variables in Nonreusable Subsystem Functions
To reduce global RAM for a nonreusable subsystem, generate a function interface that passes data through arguments instead of global variables. - Reduce Memory Usage for Models Containing Referenced Models
Reduce RAM usage for a referenced model by generating optimized code that reuses buffers or generates reusable temporary buffers to hold referenced model outputs.
코드 크기 줄이기
- 0으로 초기화하는 코드 제거
생성 코드에서 값이 0인 내부 데이터(블록 상태 및 블록 출력)와 외부 데이터(루트 인포트 및 아웃포트)를 초기화할지 여부를 제어합니다. - 생성 코드에서 ‘재설정’ 및 ‘비활성화’ 함수를 제거하기
모델 참조 계층 구조를 포함하는 ERT 기반 시스템의 생성 코드에서, 호출될 수 없는(데드 코드) 리셋 및 비활성화 함수 인스턴스를 제거합니다. - Inline Numeric Values of Block Parameters
Reduce global RAM usage by inlining the literal numeric values of block parameters. - Optimize Generated Code by Consolidating Redundant If-Else Statements
The code generator optimizes the generated code by combiningif-elsestatements that share the same condition. - 지역 변수를 0으로 설정하는 초기화 코드 생성 제어
기본적으로 코드 생성기는 지역 변수를 0으로 명시적으로 초기화하지 않습니다.
데이터 저장을 위한 메모리 줄이기
- 다른 크기와 차원의 버퍼 재사용
크기와 형태가 서로 다른 행렬의 버퍼를 재사용합니다. - Optimize Memory Usage for Time Counters
Optimize memory that the code generator allocates for an elapsed time counter. - 논리 신호에 대한 부울 데이터를 사용하여 생성 코드 최적화
코드 생성기는 논리 신호를Boolean데이터형으로 저장하여 생성 코드를 최적화합니다. - 부울 데이터를 비트 필드로 패킹하여 생성 코드를 최적화하기
코드 생성기는 부울 데이터를 1비트 비트 필드로 패킹하여 RAM 사용량을 줄입니다. - Represent Integer and Fixed-Point Data Using Bit Field Storage Class
Optimize memory by representing integer and fixed-point data using bit field storage classes in the Embedded Coder Dictionary. - 임베디드 애플리케이션을 위한 단정밀도 데이터형 지정
예를 들어, 단정밀도 프로세서를 타깃으로 할 때, 부동소수점 데이터형이 모두 단정밀도로만 구성된 코드를 생성합니다. - Generate Efficient Code by Specifying Data Types for Block Parameters
To generate more efficient code, match parameter data types with signal data types or store parameters in smaller data types. - Control Operator Type in Generated Code
Generate code with Logical or Bitwise Operators or a combination of both operators. - Generate Efficient Code Using Unified Analysis
Reduce RAM usage and data copies performing unified analysis at model-level.