cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop the example program getting recovered ?

SSaya.1
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Paul1
Lead

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

View solution in original post

2 REPLIES 2
Paul1
Lead

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

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 Venmo
Up vote any posts that you find helpful, it shows what's working..