Skip to main content
Visitor II
September 13, 2024
Solved

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

  • September 13, 2024
  • 1 reply
  • 1072 views

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.

Best answer by mƎALLEm

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.

1 reply

mƎALLEm
mƎALLEmBest answer
Technical Moderator
September 13, 2024

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."
Visitor II
September 13, 2024

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.