Custom memory section for subsystem not showing up in block

71 visualizaciones (últimos 30 días)
Quentin Coret
Quentin Coret el 21 de Nov. de 2024 a las 9:55
Respondida: Quentin Coret el 27 de Nov. de 2024 a las 10:00
I have been following the Embedded Coder guide to use custom memory sections for Subsystem.
I have created a new package with my memory section that has the pre and post direction #pragma blabla.
I have linked my data dictionary to this package, so I can see that memory section.
But whatever I do, the memory section doesn't appear in the subsystem drop down.
I must have missed something, but I can't figure it out.
I also tried adding a Function custom template. When I do, I can add it to the "Function Default" in the code mapping editor, but I don't want to change the default, I want to move one function subsystem only!
Thanks,
Quentin

Respuesta aceptada

Quentin Coret
Quentin Coret el 27 de Nov. de 2024 a las 10:00
Right, I have asked Mathworks support about this issue and they helped me figure it out. So I'm posting the solution here for reference.
Once you have created your memory section in your Embedded Coder package, you need to run this line to tell the Simulink model to use it (with your model open):
set_param(bdroot, "MemSecPackage", "coderDefs")
Once this is done, you'll see the section in the drop down menu
Last thing is to make sure the package is loaded by default in your model's Embbeded Coder dictionary.
In Code mappins (ctrl+shift+C to open), open your EC dictionary. Then in the package, make sure your new package with your custom sections are loaded:
Save your model, generate your code, and here are your #pragma:
/* Output and update for function-call system: 'XXX' */
#pragma section code cpu0_psram
void XXX(void)
{
...
}
#pragma section code restore

Más respuestas (1)

Satwik
Satwik el 21 de Nov. de 2024 a las 14:10
Hi Quentin,
I observe that you have set the 'Function packaging' to 'Nonreusable function'. To enable configuration of memory sections in this case, the 'Function with separate data' option needs to be selected. If you do not select 'Function with separate data', the subsystem data inherits memory sections from the model.
This is mentioned in the same documentation, I have highlighted the section under which this requirement is mentioned:
I hope this helps!
  1 comentario
Quentin Coret
Quentin Coret el 21 de Nov. de 2024 a las 14:33
Editada: Quentin Coret el 21 de Nov. de 2024 a las 14:35
Sorry if I wasn't clear. For now, I do not care about where to put the data. I want to change where the function is executed from (RAM instead of FLASH). And the memory section I created doesn't show up in any of the drop downs.
Doesn't change the drop-down menus

Iniciar sesión para comentar.

Categorías

Más información sobre Deployment, Integration, and Supported Hardware en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by