How to get the same code generation for a whole Simulink model and referenced subsubsyem?

조회 수: 2 (최근 30일)
I have a Simulink model simulating a system and its firmware. The firwmare is a referenced subsystem that I want to covert to C code and flash on my controller. Why when I generate the embedded code for the whole model I do not get the same interface for the referenced subsystem?
Having the same interface would allow me to test the simulation on the hardware before connecting inputs and outputs and testing the firmware only.
  댓글 수: 1
Sahas
Sahas 2025년 4월 10일
Hi @Enrica,
What do you mean by the line "I do not get the same interface for the referenced subsystem?" here?

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

채택된 답변

Mark McBroom
Mark McBroom 2025년 4월 12일
Have you tried making the sub-system atomic and then on the code generation tab, setting the desired interface for the function? Right-click the Subsystem block. From the context menu, click Block Parameters (Subsystem). From the Block Parameters: window, open the Code Generation tab.
If you are still not getting the desired code, try converting the referenced subsystem to a referenced model. In general referenced models are better than referenced subsystems for locking down the interface of the generated code.
  댓글 수: 1
Enrica
Enrica 2025년 4월 14일
Thanks for the reply!
Yes, the block of the firmware is already set to be `traten as atomic`.
I tried to convert the referenced subsystem to a referenced model and added a Configuration reference to the same configuration that every block has. It seems to work fine now.
Thanks for your help!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by