cancel
Showing results for 
Search instead for 
Did you mean: 

Why is not std::vector or std::unique_ptr using at stm32 projects with cpp?

Ahmet Yasin CİVAN
Associate III

Why is not std::vector or std::unique_ptr using at stm32 projects with cpp? When I examine stm32 projects that use cpp , I do not see modern cpp features.

6 REPLIES 6
KnarfB
Principal III

If you generate a project with STM32CubeMX/STM32CubeIDE, all the library code (CMSIS, HAL) is the same plain C, even if you choose C++. Your own C++ code can do whatever it want (and what is supported in the runtime library).

There are C++ 3rd party abstractions for peripherals like STM32duio or home grown, but not vendor supported. And, concerning all the "HAL is bloatware" discussions in this forum, C++ would have a hard time becoming a first class citicen here.

hth

KnarfB

Thank you for answer.

TDK
Guru

Dynamic memory allocation, which is used by both objects you referenced, is often frowned upon in embedded projects with limited flash and RAM memory.

I use C++ almost exclusively for my own code in projects. It has many useful features that contribute no additional memory/complexity resources.

If you feel a post has answered your question, please click "Accept as Solution".
KnarfB
Principal III

BTW: There is ETL for embedded: https://www.etlcpp.com/

Thank you, etl is very usefull.

Understood thanks.