How to generate a single ert_main.c for multiple atomic subsystems using Embedded Coder?

5 ビュー (過去 30 日間)
Sreejith Mana
Sreejith Mana 2021 年 11 月 25 日
編集済み: Aiswarya 2024 年 3 月 1 日
Hello,
I am new to Embedded Coder. I am trying to generate C code from the logic modelled in simulink. I have different atomic subsystems doing different tasks ( functions in the sense of C code). I want to generate separate .c files for each of the subsystems, but I need one single ert_main.c which calls all of the atomic subsystem function calls. May I know if this is possible?
Best regards,
Sreejith
  2 件のコメント
C B
C B 2021 年 11 月 25 日
I dont know this will work or not but maybe you can try model referancing
Let me know it works or not.
Sreejith Mana
Sreejith Mana 2021 年 12 月 3 日
No, that doesn't work.

サインインしてコメントする。

回答 (1 件)

Aiswarya
Aiswarya 2024 年 3 月 1 日
編集済み: Aiswarya 2024 年 3 月 1 日
Hi,
I understand that you want to generate code for a model involving subsystems using Embedded coder and that you would like to generate separate ".c" files for each subsytem with a single ert_main.c for the model. In order to do this, perform the following steps:
  1. Open the Configuration Parameters dialog box (Shortcut: Ctrl + E). In the Code Generation tab, navigate to Code Placement section and set the File Packaging format to be "Modular".
  2. For each of the subsytems perform the steps (Step 2 - 6) given in the following documentation link: https://www.mathworks.com/help/rtw/ug/generate-separate-code-and-files-for-subsystems-in-a-model.html#mw_a1bf424c-072c-4c8e-abf7-8f7ecabec914
On generating the code, in the Code generation report, you can observe that there is a ert_main.c file, model files and under the "Subsytem files" section there are files corresponding to each subsytem which only has code for that particular function. This way you can modularise your code as desired.

カテゴリ

Help Center および File ExchangeDeployment, Integration, and Supported Hardware についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by