Skip to main content
Andrew Neil
Super User
Nov 16, 2026 12:40 PM UTC
Question

What, exactly, is user modifiable ?

I get that MX2 takes a different approach to “User” code than MX1:

https://dev.st.com/stm32cube-docs/stm32cubemx2/1.2.0/en/docs/markup/STM32CubeMX2_FAQ.html#why-are-there-no-user-sections-in-stm32cubemx2-generated-code

 

But what, exactly, does MX2 consider to be “User” code?

I can see that there’s a user_modifiable folder created:

 

Does that mean that everything under there will never be touched by code (re-)generation?

Should the user keep away from modifying anything under any of the other folders?

Is the user allowed to add other folders to the project at this level?

 

The screenshot is from the ST hal_gpio_toggle_cmake example.

It seems to contain “User” code at the top level:

The main.c is generated by MX2 - is it considered “User” code?

I don’t think the example.c is generated by MX”? So is it OK to put other User files here ?

 

See also: