
How to generate custom unoptimized code within a system composer software architecture model?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alex
el 7 de Abr. de 2025
Comentada: Mark McBroom
el 15 de Abr. de 2025
C-function code generation appears to work differently when generating code inside of a system composer software architecture model isntead of a standalone simulink model. I am trying to insert certain processer primitaves (mutexes) into my simulink model such that it is incorporated into the autogenerated code. It is a few simple lines of c++ code, so I opted to use the C-function block. In both cases, I have specified in the c-function dialogue window "Generate code as-is (optimizations off)"

Inside of an export-function simulink model, I created a c-function block that includes a comment and then a simple line of code, which generates correctly:

However, if I copy this exact same c-function into an export-function model within a system composer software architecture model, it no longer generates my my specified code. Instead, it generates function calls but does not define the functions anywhere. (Even doing a simple text search of my entire workspace only shows that the function call shown below gets generated).

0 comentarios
Respuesta aceptada
Josh Kahn
el 8 de Abr. de 2025
I see the code from the c-caller block when I tried. Can you look at the attached and see if there are any differences in how we configured the models?
Josh

6 comentarios
Mark McBroom
el 15 de Abr. de 2025
The System Outputs block can be used as an alternate approach to inject arbitrary code into the generated C++ code.

Más respuestas (0)
Ver también
Categorías
Más información sobre System Composer en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!