cancel
Showing results for 
Search instead for 
Did you mean: 

Is that possible to enable/disable editing the generated code with CubeMx

Scipio
Associate

Hi,

is any possibility to protect editing code generated with in STM32Cube. I sometimes made some mistake and change the generated code. It would by good, if it is in STMCube some toggle button, that I can enable disable editing the the code generated with STMCube. The user code would be editable every time.

The best solution would be if the not editable text code will be sad or grey.

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

Hello,

There is no feature to lock the code generated by CubeMx.

Only "don't generate main.c" (from Project manager) and "don't generate function call" (from Advanced Settings) are available.

Meanwhile, for this:


@Scipio wrote:

I sometimes made some mistake and change the generated code. 


I suggest to use one of the versioning tool like git/github to keep traces of your modification and be able to revert to a previous version.

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.

View solution in original post

2 REPLIES 2
SofLit
ST Employee

Hello,

There is no feature to lock the code generated by CubeMx.

Only "don't generate main.c" (from Project manager) and "don't generate function call" (from Advanced Settings) are available.

Meanwhile, for this:


@Scipio wrote:

I sometimes made some mistake and change the generated code. 


I suggest to use one of the versioning tool like git/github to keep traces of your modification and be able to revert to a previous version.

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.

STM32CubeIDE doesn’t offer a direct "toggle read-only" feature for generated code sections. You can use external text editors like Visual Studio Code with specific plugins that allow locking parts of the code or syntax highlighting that dims auto-generated code.