User Code Start - End Structure In Simulink / Embedded Coder

Is there a user code start - end structure in simulink coder frameworks? I am using embedded coder. I am modifying the code generated by the Simulink. But If I change something on the model and re-generate the code, the piece of code that I added / modified is being overwrite.
For example, In the STM32 Cube-MX or other IDEs that support HAL with code generation, there is a User Code Start - End structure that allows code generation without loss of user code.
Let's say we have a piece of code, generated by the Simulink below;
/* User Code Start (1) */
// This piece of code will not be overwrite by the code generator.
foo();
/* User Code End (1) */

2 件のコメント

OGUZ AYDIN
OGUZ AYDIN 2022 年 10 月 3 日
I couldn't find a solution for this problem either. Whenever I edit and compile the generating code from Simulink by using Simulink/Embedded Coder, then the code is overwritten.
Mark McBroom
Mark McBroom 2022 年 10 月 23 日
Simulink Coder/Embedded Coder will always write the entire <model>.c. You should not modify the generated code. If you need to insert hand-written C/C++ code into the Simulink model, you can do this with the C Function block or C Caller block.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink Coder についてさらに検索

製品

リリース

R2022a

質問済み:

2022 年 10 月 3 日

コメント済み:

2022 年 10 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by