How to implement #pragma directives in simulink for a model that should be built with embedded coder using custom storage classes and memory sections?

I need to implement pragma directives from simulink to store the variables associated to my simulink model built with embedded coder in different RAM sections of my target hardaware following this method:
The reason behind that is that the target hardware is divided into 4 RAM sections with limited capability and RAM1 (the defualt one) is currently out of memory.
To do so I created a custom storage class with its associated memory section whose pre-statment and post statement have been properly filled to re-create the same definition required by the pragma directive I'm trying use.
and stored the csc_registration inside the +CustomMemSections together with the custom Paramters.m and Signals.m file needed to define the CustomMemSections.Paramter and CustomMemSections.Signal (all these files are attached) according to the following folder structure:
Then, once created the custom storage class, I've added the CustomMemSection to the embdded coder dictionary as it follows:
Afterwards I went on modifying the code mappings in the following way:
But I'm getting some troubles completing the build with embedded coder of my simulink model. In particular I cannot solve this error (and may others similar):
For reference, the model is hierarchically built with with a large top model that contrains one or more nested referenced model.
Do I need to set the code mappings for each referenced model?
Is there someting wrong on my custom storage classes and memory section definitons?
For completness I'm also uploading the files I'm using for defining the custom CSC registration, custiom paramters and custom signals.

Answers (0)

Categories

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

Products

Release

R2025b

Asked:

on 28 May 2026 at 13:11

Edited:

on 28 May 2026 at 13:34

Community Treasure Hunt

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

Start Hunting!