cancel
Showing results for 
Search instead for 
Did you mean: 

After STM32CubeMX generated the code, the file I created earlier disappeared

sky_lin
Associate II

Hello,
         After I use STM32CUBEIDE's built-in STM32CUBEMX to generate code, the source files and header files under the folder I created myself disappeared, how can this be solved?

        Before I use STM32CUBEIDE's built-in STM32CUBEMX to generate code:

sky_lin_0-1754636938922.png

      After I use STM32CUBEIDE's built-in STM32CUBEMX to generate code,all the files I created disappeared.

sky_lin_1-1754637066045.png

     The compilation path of the file I created has already been saved, and I also checked the keep user code when re-generating option

sky_lin_2-1754637289095.pngsky_lin_3-1754637346653.png

 

6 REPLIES 6
Souhaib MAZHOUD
ST Employee

Hello @sky_lin 

Could you attach your project to investigate the issue?

KR,

Souhaib

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.

Yeah , I have uploaded my project.

Also see this (in the "too late to help this time but will help NEXT time): https://community.st.com/t5/stm32cubeide-mcus/my-usb-cdc-if-file-was-deleted-by-code-automatically-without/m-p/814264#M36899

Even the best written tools can fall prey to OS/hardware issues beyond their control and corrupt your data.

Hello @sky_lin 

Could you please check the copy only the necessary files, this is will keep your custom files.

SouhaibMAZHOUD_0-1755077035679.png

KR,

Souhaib

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.

I checked this option and changed it to the next option, but the problem persists

Hello @sky_lin 

Thank you for your detailed explanation.

The dedicated team are already aware of this issue (Internal Ticket number 196837), and fix will be implemented soon. In meantime, I recommend not placing your folder inside any CubeMX-generated directories (Drivers, Core, Middleware). Instead, please place it directly under the project root.

BR,

Souhaib

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.