Skip to main content
SSaya.1
Associate III
August 9, 2021
Solved

How to stop the example program getting recovered ?

  • August 9, 2021
  • 2 replies
  • 768 views

when the example file is modified but the original program gets recovered when the Device Configuration Tool Code Generation is hit after some changes in ioc file.

#stm32wl55jc

Its hard to start from the scratch in LoRa subghz, Do anyone have some methods?

Thank you

This topic has been closed for replies.
Best answer by Paul1

If you modify any generated files:

  • Put code only between the comments that say "user code here", and click the checkbox for retain user code: MX > Project Manager > Code Generator > +"Keep User Code When Regenerating"
  • Keep your code in a version control system, or at least zip projects and put on a backup device.
  • Don't put your code in main.c, Put your code in main2.c (or main2.cpp), and put a call to main2() in main(). When regenerate ensure the init code in main2() is updated to match main(). Few extra steps needed for change to support cpp files.
  • Better yet put all your own code in a separate folder (ProjectCode or MyCode, next to Core)
  • Create a document to log **all the changes** you do to generated files, so down the road you or others will know how to create similar projects, or recreate this project if it gets corrupted, or a major STM32Cube change occurs and auto update doesn't work.

Paul

2 replies

Paul1
Paul1Best answer
Senior III
August 9, 2021

If you modify any generated files:

  • Put code only between the comments that say "user code here", and click the checkbox for retain user code: MX > Project Manager > Code Generator > +"Keep User Code When Regenerating"
  • Keep your code in a version control system, or at least zip projects and put on a backup device.
  • Don't put your code in main.c, Put your code in main2.c (or main2.cpp), and put a call to main2() in main(). When regenerate ensure the init code in main2() is updated to match main(). Few extra steps needed for change to support cpp files.
  • Better yet put all your own code in a separate folder (ProjectCode or MyCode, next to Core)
  • Create a document to log **all the changes** you do to generated files, so down the road you or others will know how to create similar projects, or recreate this project if it gets corrupted, or a major STM32Cube change occurs and auto update doesn't work.

Paul

Tesla DeLorean
Guru
August 9, 2021

Develop and modify code in a sandbox, not in a directory/tree that automated tools are likely to overwrite, modify or delete.

Move your code into a sandbox, and use source code management tools to archive/save it

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..