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
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
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 Exchange 中查找有关 Simulink Coder 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!