Skip to main content
Dave Nadler
Senior III
May 13, 2019 8:33 PM UTC
Question

Bug: STM32CubeIDE deleted all my source code (generate code on imported project)

I imported a project into STM32CubeIDE (from Atollic).

The Release configuration was deleted (bug), but otherwise the project looked OK.

Double-clicked on project's IOC file to start CubeMX (bug, IDE doesn't find this and otherwise CubeMX perspective comes up blank).

IOC was converted to latest version without any errors.

BUG: Generate Code wiped out all of my sources in the imported project!

Yikes.

Is there a stable release coming any time soon?

Meanwhile we'll need to stick with Atollic.

Thanks,

Best Regards, Dave

This topic has been closed for replies.

23 replies

ecode
Associate
Dec 9, 2019 7:11 PM UTC

I use stm32cube ide 1.1.0

Laptop un-charged and shut down. The main.c file was deleted when I opened it. main.c is hollow. I am very sad. It was an important project.

main.c :

0000 0000 0000 0000 0000 0000 0000 0000

0000 0000 0000 0000 0000 0000 0000 0000

0000 0000 0000 0000 0000 0000 0000 0000

0000 0000 0000 0000 0000 0000 0000 0000

0000 0000 0000 0000 0000 0000 0000 0000

......

AUrez.1
Associate
Jun 4, 2020 8:08 AM UTC

I use version 1.3.0 and have the same problem.

Lose all my code after minimal changes in .ioc

Cartu38 OpenDev
Graduate II
Jun 14, 2020 7:41 PM UTC

Sounds weird ... nobody else is complaining back about on such forum (was a lot prior 1.2.0 release). Are you loosing full file(s) or some custom code added within genrated file(s) ? If generated file update please takes care about predefined user sections ... your custom code as to be part of to be preserved ...

Please confirm your issue and possibly share your project / .ioc file / snapshots.

AUrez.1
Associate
Jun 15, 2020 11:56 AM UTC

Thanks for reply.

To tell the truth, I have already found a reason. That was my mistake during CubeMX settings. Now question is closed for me.

EM.1
Associate
Aug 10, 2020 3:04 PM UTC

HELP, PLEASE!!!

I just generated code in STM32Cube 1.3 after changing something in the IO configuration, somehow over 1000 lines of code have been deleted, I have been working on this code for a month now,

Does anyone know how to get back this code? I forgot to add to git....

Why does this happen?

Tesla DeLorean
Guru
Aug 10, 2020 4:35 PM UTC

Try right-clicking on the folder(s) in windows and "Restore previous versions"

>>Why does this happen?

Well historically it has been the IOC parser detects some syntax error or anomaly, perhaps due to bug fixes (old file now has unacceptable syntax), and rather than recover gracefully it fails hard. As I recall sometimes this had a poorly worded or ambiguous popup giving you a 50/50 chance, or worse, of destroying the project. ie About to erase current project, would you like fries with that? Yes/No

In more conservative auto-gen tools, you'd archive prior content rather than unlink or create-new over the current live project files. At the very least backup any files with user generated content. In a well considered implementation, you'd provide a means to diff/merge, or recover things from the journal of changed project files, and pin/peripherals settings.

How this stuff gets written and tested troubles me.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Cartu38 OpenDev
Graduate II
Aug 10, 2020 5:04 PM UTC

Try latest 1.4.1 release despite first time issue reported on 1.3.x ....

Dave Nadler
Senior III
Aug 10, 2020 5:55 PM UTC

@EM.1​  Here's the workflow we used to work-around ST tools deficiencies:

http://www.nadler.com/backups/20200111_draft2_STM_Cube_Issues_and_Workflow.html

Never, never, ever, regenerate code with automated tools (from any vendor) before doing a source control commit!!!

Hope that helps,

Best Regards, Dave

EM.1
Associate
Aug 11, 2020 6:40 AM UTC

Thank for you help,

In the windows file restore dialog it says: There are no previous versions available

this feature only works if we first configure windows to back up the files

Is there anything I can do to restore this code? their was a lot of energy time and research involved in writing this code, (mercy... help... please...)

Any help will be highly appreciated,

Thank You

Cartu38 OpenDev
Graduate II
Aug 12, 2020 11:43 AM UTC

Have try to create lost file setting same path name and extension. Right click on then. Maybe "replace with local history" may works.​

MVand.3
Associate II
Oct 27, 2021 6:47 PM UTC

I just wanted to jump in with a tip I just discovered to restore files within the STM32CubeIDE. It's actually a feature of Eclipse which STM32CubeIDE is based on. Simply right click the file in the "Project Explorer" on the left and go to "Replace With -> Local History..." Inside there were dozens of previous versions of the file that cubemx had overwritten and it restored it for me! This just saved me a whole day's worth of work. Hope this is helpful to some people.