Can CubeMX generate a cpp file
I'm using "STM32CubeIDE for Visual Studio Code" on Ubuntu 22.04. I have a situation where I'm making a driver for a chip where it very much benefits me to make the driver into a class and instantiate several instances of it.
Generally speaking, what are the best practices here, if I still want to use the CubeMX code generation?
At the moment, here's what I'm doing:
- Add `CXX` to the languages in the `./CMakeLists.txt` file. Also add the driver.cpp file to the target_sources() directive in `./CmakeLists.txt`.
- Change the file extension of main.c to main.cpp
- Change the ./cmake/stm32cubemx/CMakeLists.txt to reference the main.cpp file
I was planning on automating this with a pre and post script which would do a `mv main.cpp main.c` and `mv main.c main.cpp`. And then also changing the generated CMakeLists.txt to reference the main.cpp.
However, it seems that a simple bash script isn't being run.
- Is there a less hacky way to do this?
- Does the Before Code Generation and After Code Generation files use bash scripts? Or something else?
