Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

STM32CubeMX C to C++ exporter

STM32Cube IDE is able to make a C++ project. However, even with these settings, the CubeMX tool generates a main.c every time there is a change in peripheral configurations. Copying user code from the old main.cpp to the newly generated main.c can become annoying after a while. So I wrote a simple python script to overcome this problem.

How it works

The script copies user code from the old main.cpp to the newly generated main.c. It then deletes main.cpp and renames main.c to main.cpp. After these steps, .cpp will be the main file, when compiling the project. Hooray, problem solved! 🥳

Usage

  1. Copy the python file to the base folder of STM32Cube C++ project.

  2. After making a change in MX graphical interface, that generates new code, run the python script.

  3. Enjoy the result of your work!

About

Convert old user code from main.cpp to newly generated main.c via STM32Cube MX

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages