Observations: CubeMX2 1.1.1 will not restore deleted main.c (different behavior compared to CubeMX6)
Software version: STM32CubeMX2 1.1.1 Target MCU: STM32C542RCT6
Steps I followed:
- Created a new project and generated the CMake‑based IDE project to a target folder.
- Closed CubeMX2, then manually deleted
Core/Src/main.cvia file explorer. - Opened the original
.mx2project file again, kept using the same output directory, and clickedGenerate IDE project.
Observed behavior: After code generation finishes, main.c is still missing from the folder. There is no warning message or popup to notify me the main entry‑point file is absent. Consequence: CMake build fails with undefined reference to main.
In legacy CubeMX6, when main.c was removed, code‑generation would recreate this template file automatically. This does not happen in CubeMX2 1.1.1.
Current workaround: I have to generate project files into a brand‑new empty folder to get a fresh copy of main.c, then copy this file back to my original project directory.
Analysis: It seems CubeMX2 treats main.c as a user‑modified file and skips regeneration. However it does not handle the scenario where the file has been manually deleted from disk. Developers coming from CubeMX6 may not expect this difference in behavior and can run into build issues. It would be helpful to add a warning if main.c is missing.
