Skip to main content
GCrow.1
Associate
Nov 12, 2020 12:53 PM UTC
Solved

Hello STM32 Forum, If I modify and then generate code in SMT32CubeIDE (Version: 1.4.0 Build: 7511_20200720_0928 (UTC)), any code I add to main.c is deleted. I saw on a forum post that 'keep user generated code' must be ticked but I cannot find it

..

This topic has been closed for replies.
sivaram
sivaramBest answer
Associate III
Nov 12, 2020 1:12 PM UTC

open the .ioc file in IDE, then click the 'project manager' tab of the ioc file and then click the 'Code Generator' from the left, you will find the option.

4 replies

sivaram
sivaramBest answer
Associate III
Nov 12, 2020 1:12 PM UTC

open the .ioc file in IDE, then click the 'project manager' tab of the ioc file and then click the 'Code Generator' from the left, you will find the option.

GCrow.1
GCrow.1Author
Associate
Nov 12, 2020 1:16 PM UTC

Great, thank you, just figured it out! I am going to have to get used to having code deleted if its not in the correct place.

TDK
Nov 12, 2020 2:21 PM UTC

Code between USER CODE tags will not be deleted. Don't put code anywhere else:

 /* USER CODE BEGIN *** */
 
 // your code here
 
 /* USER CODE END *** */

"If you feel a post has answered your question, please click ""Accept as Solution""."
ST Technical Moderator
Nov 13, 2020 2:11 PM UTC

Hi @GCrow.1​ ,

When your question is answered, please close this thread by choosing "Select as Best".

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks