Reputation: 5684
I have a project where I need to add a few lines to one of the generated C files. However, the place where I want to add the change does not have a "USER CODE BEGIN / END" section. So whenever, I regenerate code, the changes are overwritten. I tried adding my own user code section as shown below but even that got overwritten. It seems, CubeMX is looks for a predefined set of USER CODE blocks, and overwrites everything else.
/* USER CODE BEGIN 8 */
/* USER CODE END 8 */
I would like to be able to define my own user code blocks so that I can write custom code in places where CubeMX has not already provided a user code block.
Upvotes: 7
Views: 8718
Reputation: 613
Adding custom user code sections is not supported by CubeMX.
See this support post:
Upvotes: 6