2015-10-01 05:01 AM
I'm using STM32-MAT/TARGET in Simulink 2014a and STM32CubeMX + KEIL MDK-ARM V5.
My model has custom inputs and outputs, so I have to set/read them before/after the step-function in the main loop.
My problem is, every code i write there gets overridden my simulink code generator, in the whole main.c file. STM32CubeMX on it's onw does not override user code, only Simulink does. How can i handle this? #mat/target #simulink2015-10-02 02:53 AM
Hi hieber.jan,
Do you mean that even code in ''USER Code'' sections is overwritten by Simulink?-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2015-10-04 02:55 AM
Yes.
When i generate code with STM32CubeMX only, the USER sections marked with the comments are not overwritten. But as soon as MATLAB comes in, it overwrites the whole main.c file. So when i want to process input/output data from the model before/after the step function, the code is lost every time i generate the code with simulink.2015-10-04 04:11 AM
Perhaps the easiest way to tackle this is to keep a primary copy of the app with your modifications, and use something like WinMerge to pull back in the user functionality each time you iterate the design in your generator tools. Probably not as ideal as an integrated solution, but perhaps the path of least resistance.
2015-10-09 07:16 AM
OK thanks very much.
Can be closed.2015-11-06 08:27 AM
Hi All,
modification will be integrated into next STM32-MAT/TARGET version to solve this problem. A preference will be added to overwrite or not main.c file with Simulink generated one. Regards