Custom Storage Class and Memory Section not visible in Code Mappings

12 views (last 30 days)
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 Comment
Djordje
Djordje on 17 Oct 2024
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.

Sign in to comment.

Answers (1)

Sumukh
Sumukh on 3 Oct 2024
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 Comment
Djordje
Djordje on 4 Oct 2024
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.

Sign in to comment.

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!