STM32CubeIDE -- using libs from arduino

Development environment specific, Arduino, Eclipse, VS2013, Em::Blocks etc
Post Reply
Posts: 9
Joined: Thu Feb 13, 2020 4:50 pm

STM32CubeIDE -- using libs from arduino

Post by alfsch »

in the STM32CubeIDE i already use a lib from the arduino-universe ; it is in plain C , so include xx.c + xx.h and it is working.

but what if the lib is in C++ ? and including a lot of other libs and defines ? how to get it working in STM32CubeIDE ?

User avatar
Posts: 866
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 34
Location: Le Mans

Re: STM32CubeIDE -- using libs from arduino

Post by fpiSTM »

I never tried.
I think you should as on ST community about C++ usage in STM32CubeIDE.
Posts: 2
Joined: Fri Apr 24, 2020 5:54 pm

Re: STM32CubeIDE -- using libs from arduino

Post by mapy »

Hi , please is there any documented process/tutorial on how to integrate STM32duino in STM32CubeIde?

thank you very much
Posts: 27
Joined: Fri Dec 20, 2019 6:47 pm

Re: STM32CubeIDE -- using libs from arduino

Post by sheepdoll »

I have not installed STM32CubeIDE yet. Looks like it is eclipse based. I have used SW4STM32 for some time now which is also eclipse based.

Eclipse has an item in the project menu, which is to convert project to C++. The way I work is to use CubeMX to define the project. Then I generate a SW4STM32 project and open the folder. Then do the 'open project from folder' menu option. Rename Main.c to Main.cpp then use the project menu to convert to C++. I usually do a test compile.

Next I copy the lib folders to the project in the workspace. I do a refresh from the project menu. Then one has to go into the preferences to get to the C tools for libary and path. This is where it gets a bit tricky. There are a number of online video tutorials that show this. You have to include the libary folders which is usually the first tab of the C++ paths. You type the folder name in directly. Then one has to go to the source tab and include the source folders. Eclipse is not consistant, in this case one chooses add and the folder from a drop down menu. (Why you have to do the refesh from the project menu first.)

Now you should be able to index the project. Most likley there will be a bunch of syntax errors. These have to be fixed to use the HAL GPIO includes (usually main.h where the pin definitions are and the hal include which is usually #include "stm32f4xx_hal.h" for one of the F4 boards. main.h includes the latter. Which one is included depends on if you need the GPIO pin names or not.
Post Reply

Return to “IDE's”