Custom Storage Class and Memory Section not visible in Code Mappings

조회 수: 17 (최근 30일)
Djordje
Djordje 2024년 9월 25일
편집: Djordje 2024년 10월 17일
Hello,
I am trying to use a custom memory section in the generated code to add specific memmap definitions and includes around certain global variables. As I am using external dictionary, idea is to add these memory section/storage class definitions as part of it:
All these settings (previews) look good, but I cannot find them available in Code Mappings.
As per Model Explorer they are already linked to my model, I am not sure what are aditional steps to make them visible to the Code Mappings editor. Could you please provide some hints in order to make connections between custom memory sections and variables in the generated code?
I use grtl.tlc in code generation settings.
EDIT:
  댓글 수: 1
Djordje
Djordje 2024년 10월 17일
Hello,
For everyone who cannot find storage class in "Code Mappings - Component Interface", this could be one of potential root causes.
When I defined a storage, I configured immediatelly all properties. Property named "Data Initialization" I configured to "Static". That was the root cause of this issue. After I reverted it to "Auto", new custom Storage Class appeared in Code Mappings as an option.
Advice for proceeding with storage class creation:
  1. Create a storage class, and save it with all default values.
  2. This one should be available in code mappings - confirm it.
  3. Select it for a desired object (e.g. some Inport(s))
  4. Proceed with customization of created Storage Class
  5. If you select wrong value for some property, Code Generator will raise errors, and you will find a root cause easier. You can then also do your customization incrementally with doing code generation. In my case, error was missing, because I even couldn't choose new Storage Class in Code Mappings.

댓글을 달려면 로그인하십시오.

답변 (1개)

Sumukh
Sumukh 2024년 10월 3일
Hi Djordje,
Based on the images provided, my understanding is that a custom storage class has been created in Embedded Coder Dictionary and the custom class is not appearing as an option in the Storage Class dropdown for Global data stores data element.
Global data stores are data stores defined by a signal object in the base workspace or in a data dictionary. These stores cannot be mapped to a custom storage class defined in the Embedded Coder dictionary, excluding the predefined storage classes. You can refer to the following documentation that states this limitation for global data stores:
I hope this answers your query.
  댓글 수: 1
Djordje
Djordje 2024년 10월 4일
Hello Sumukh,
Let me be more specific with my question. In the generated code, I have the following 3 variables.
What would be the way, to put them into section "MemBss", which is presented in the first question?
/* Block states (default storage) */
DW_mr_control_T mr_control_DW;
/* External inputs (root inport signals with default storage) */
ExtU_mr_control_T mr_control_U;
/* External outputs (root outports fed by signals with default storage) */
ExtY_mr_control_T mr_control_Y;
/* Real-time model */
static RT_MODEL_mr_control_T mr_control_M_;
As the generation output, I would like to have the following:
#define CONTROL_LOOP_START_SEC_VAR_CLEARED_32
#include "control_loop_memmap.h"
/* Block states (default storage) */
DW_mr_control_T mr_control_DW;
/* External inputs (root inport signals with default storage) */
ExtU_mr_control_T mr_control_U;
/* External outputs (root outports fed by signals with default storage) */
ExtY_mr_control_T mr_control_Y;
/* Real-time model */
static RT_MODEL_mr_control_T mr_control_M_;
#define CONTROL_LOOP_STOP_SEC_VAR_CLEARED_32
#include "control_loop_memmap.h"
My understanding was that it goes through Code Mappings, where we need to choose a custom Storage Class for the desired variables or set of variables. Now I am confused, but I hope I explained what I need as the result in the end.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by