Apply memory sections for model functions
조회 수: 15 (최근 30일)
이전 댓글 표시
Hello,
I generated a C code which is compliant with AUTOSAR from a matlab model and I would like to insert memory sections for model data and functions, so I created a package containing the memory sections and in the configuration parameters : code generation -> memory sections I selected my package and for each category : Initialize / terminate , Exceution , shared utility , constants etc. I set the defined memory section. However After generating the code, I get only memory sections for the variables, shared utility and constants but not for the model functions : Initialize and Model step functions.
Does anyone have any idea how to set memory sections for model functions ?
댓글 수: 1
haoran
2025년 9월 18일
Hello
Could you please tell me which version MATLAB you are using? Cuz I can't find code generation -> memory sections in my settings ( I'm using MATLAB 2021a now).
답변 (1개)
Ashutosh Thakur
2024년 6월 19일
Hi Nour,
You have created an AUTOSAR package with memory sections for the model initialize and step functions. A possible approach is to use SwAddrMethods in AUTOSAR and set the MemSecFuncInitTerm property using the set_param API. The default behavior will suppress the use of memory sections for Initialize, Start, and Terminate functions. The following links can be referred to for more information:
- https://www.mathworks.com/help/ecoder/ref/initializeterminate.html
- https://www.mathworks.com/help/autosar/ug/programmatically-manage-shared-interfaces-and-data-types-for-architecture-models.html
Also, since you are generating C code only, you might have to use the Code Mappings Editor - C or the Embedded Coder dictionary in order to utilize this functionality.
- https://www.mathworks.com/help/ecoder/ref/codemappingseditorc.html
- https://www.mathworks.com/help/ecoder/ref/embeddedcoderdictionary.html
- https://www.mathworks.com/help/ecoder/ug/separation-of-code-definitions-and-model-specific-data-and-function-configurations.html?searchHighlight=MemSecFuncInitTerm&s_tid=srchtitle_support_results_3_MemSecFuncInitTerm
I hope this helps you.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 AUTOSAR Blockset에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!