필터 지우기
필터 지우기

Embedded Coder - How to generate code from subsystems, without optimizations ?

조회 수: 2 (최근 30일)
Hello ,
I want to generate C Code from my simulink model (with embedded coder).
In my simulink model there are 2 subsystems and I want to generate 2 functions (division and product) with input and output.
With the standard configuration the embedded coder generates a single big function with no input and output.
Moreover, I can't treat a subsystem like a matlab function block. With a matlab function block I can go in Block Parameters ---> Code Generation and set up all configurations for optimizations like here:
https://it.mathworks.com/matlabcentral/answers/597790-embedded-coder-how-to-generate-code-without-optimizations?s_tid=prof_contriblnk
I can't do it with a subsystem.
How can I improve my code generation with functions that correspond to subsystem block?

채택된 답변

Jonas
Jonas 2021년 3월 26일
You can force Embedded Coder to create a separate function of a Subsystem by checking the option 'Treat as Atomic Subsystem' from the Block Parameters menu. Then, in the Code Generation tab you can choose what kind of function you want to to be (inline, reusable, ...).
I don't know what you mean by further optimisations. But you control the input and output specification of a subsystem function by changing the setting of those Inport and Outport blocks.
  댓글 수: 1
Giuseppe Narracci
Giuseppe Narracci 2021년 3월 26일
Hello Jonas.
Thank you for your answer and it worked!
For optimization I meant that, for example, a division and a product are executed in a line of code. Instead, I wanted to call , separately, 2 functions (division and product) and I reached the goal. Thank you so much.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by