cancel
Showing results for 
Search instead for 
Did you mean: 

BSP functions in CubeMX

andre-83
Associate
Posted on May 03, 2016 at 22:24

Hi,

I'm using CubeMX and System Workbench by AC6 on STM32F407-vgt6 to develop some basic projects for university purposes. First of all I'm studying Cube firmware's examples to understand how to work with the board in the right way and I noticed the use of some functions such as ''BSP_LED_On(LED4);'' that are not defined in the HAL library, but in the BSP files.

When I try to generate a new CubeMX project and import it into eclipse, I can't see the BSP folder within the Driver folder which contains all the HAL and CMSIS drivers.

Is there a way to make CubeMX add this library in my project, too? Or, since I know where this file are saved, how to add it to the current project without build errors by Eclipse?

Thank you in advance.

A.A.

#cubemx #bsp #stm32f4 #library
3 REPLIES 3
Posted on May 04, 2016 at 09:03

AC6 has very little to do with the HAL and nothing to do with Cube. They provide the BSP and put it on top of ST's HAL when you create your project from within Eclipse.

If you use Cube to create your project, you bypass the inclusion of the BSP. 

From teaching my class and playing with AC6, I have found the BSP to be, initially, convenient, but generally not necessary. Then when you look at some of the code, like for the gyro on the 401C discovery board, WOW such bad code. Needless object oriented misguidedness for something that gets instantiated exactly once, and debugged by everybody.

I suggest that you take the good bits from the BSP that you like and create your own. I never found LED3 to be very useful. Put in some good names in Cube and use the defines in mxconstants.h. I layered on LED_BLUE over the BSP LED3 (or whatever it was) almost immediately.

I find that Cube is much more useful for bringing up a board and getting me to the point where I can lay on my application code.

Andrei from The Great White North

(as seen on the Embedded.fm podcast and the Embedded Wednesdays posts on Embedded.fm/blog)
Walid FTITI_O
Senior II
Posted on May 04, 2016 at 11:13

Hi aa.andrea,

Some extra library package like BSP and Stemwin still not supported in the code generation. It should be added manually to the project generated under project's workspace.

-Hannibal-

andre-83
Associate
Posted on May 07, 2016 at 09:32

I will take your advice of course, because, even if bsp could be useful, CubeMX is essential for me.

Thank you for explanations, chichak.andrei and Hannibal.