cancel
Showing results for 
Search instead for 
Did you mean: 

Avoiding CubeMX to remove user changes to original code

smassardi
Associate

Hi

I'm working on a firmware based on a STM32WL libraries example, specifically LoraWan_End_Node for WL55JC.

The example sends data every 10s but also performs several operations using leds and timer. I need to remove some parts of this original code and sometimes write outside the USER_CODE_BEGIN/END sections.

The problem is, when I use CubeMX it will restore the original code where I changed it. Is there any way to prevent this restoring? And at the same time be able to use the CubeMX.

Thanks 

1 REPLY 1
Andrew Neil
Super User

@smassardi wrote:

Is there any way to prevent this restoring?


No. That is the defined behaviour - only code within the USER CODE markers is retained.

You will have to manually merge your changes back into the code.

There is an option to have CubeMX backup the files that it re-generates:

AndrewNeil_0-1753354022006.png

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.