2021-09-09 08:44 AM
Hello,
I would like to add some code in the generated file "stm32g4xx_it.c" but I can't find any template.
Does anybody know how persistent code can be added to that file?
I know that there are user code sections but I'm using Simulink to generate code and my code is overwritten by Simulink...
2021-09-15 02:40 AM
Hi TOtt.1 ,
The template is inside the CubeMX code and can't be probably changed.
For your problem is there solution: Simulink will generate code into separate file and this file will be included into "stm32g4xx_it.c" in the section :
/* USER CODE BEGIN Includes */
#include "simulink_code.c"
/* USER CODE END Includes */
By this solution you can independently generate Simulink code and CubeMX code.
Regards
Igor
2021-09-15 04:14 AM
Hi Igor,
thank you very much for the solution!
In the meantime I found another solution which also works:
In the STM32 Matlab board support package resides a file with the name "customRoutineProcess.tlc". This tlc file tells Simulink to create the file "stm32g4xx_it.c". If this is used as a 'template' for the CubeMX tool and code is written in the user code section this code is also not overwritten by CubeMX.
BTW: We would appreciate it if ST would proceed with developing the STM32 Matlab board support package!
Regards
Thorsten