First project for STM32 with HAL in C++

unitatem picture unitatem · Feb 9, 2016 · Viewed 25k times · Source

I would like to create a project for STM32 with HAL in C++. Unfortunately, CubeMX supports only projects in C. However, HAL support C++.

I have created a project in CubeMX and I was trying to import it to any of the IDEs above but without any success because it is imported as a C project. So it doesn't look like a good solution.

Also, I have tried creating a C++ project in the mentioned IDE and adding to it files from CubeMX. It seems to be more logic but I can't do it in the right way because my configuration is still wrong.

Could anyone explain me how should I configure new C++ projects in Eclipse or Atollic TrueSTUDIO in order to use HAL?

Answer

Jeroen picture Jeroen · Feb 11, 2016

Recent versions of CubeMX support System Workbench 4 STM32, which is an Eclipse-based IDE pre-configured to develop for STM32 targets. It has the option to convert a project to C++ (Right-click on the project in the project explorer, then select "Convert to C++").

Note that I have no direct experience using this method. We use the STM HAL and build our C++ applications on top of that, so this is definitely possible, but our IDE is Keil, so YMMV.