cancel
Showing results for 
Search instead for 
Did you mean: 

What is the relationship between CubeMX code and the BSP?

David Brooks
Associate II
Posted on May 26, 2016 at 17:14

I have created a new IAR Workbench project using the 469i-Disco board that started as a collection of various projects found in the CubeMX Repository that include the following features: LCD, Touchscreen, SD Card with Chan FatFs, DMA2D, DSIHOST and RTC. I started the CubeMX project by selecting the 469i-Disco board and was expecting Cube to know how to generate code for this board. (It doesn't really.) I was surprised that CubeMX adds the bsp_driver_sd.c file to my project and this is the only bsp_xxx.c file it adds to the project. Inclusion of this bsp_ file results in compiler errors where functions have been redefined. This bsp_ file conflicts with functions already defined in stm32469i_discovery_sd.c, which came from the example projects.

So, did CubeMX make a mistake in adding the bsp_driver_sd.c file to my project or not? And why didn't it include bsp_xxx files to replace stm32469i_discovery_lcd.c, stm32469i_discovery_sdram.c and stm32469i_discovery_ts.c files.

Is the intended approach to configure CubeMX to match the settings in the stm32469i_discovery_xx.c files and then eliminate them from the project? Or what?

A broader question is, what is the intended relationship between Cube-generated files/functions and bsp files/functions?

Can't wait until all of the Example Projects get converted to CubeMX!!!
7 REPLIES 7
Walid FTITI_O
Senior II
Posted on May 26, 2016 at 18:44

Hi dmbrooks44,

What is the version of CubeMx you are using ?

BSP library shouldn't be generated by CubeMx , it is added manually by user if needed.

Then try , the last version of 4.150 and tell me if the problem still existing. Try to share your .ico file

-Hannibal-

David Brooks
Associate II
Posted on May 26, 2016 at 19:06

V4.14

David Brooks
Associate II
Posted on May 26, 2016 at 19:30

I upgraded to V4.15 and it also adds the bsp_driver_sd.c file to my project .

Also, can you guys get that ''const Diskio_drvTypeDef  SD_Driver ={}'' fixed in sd_diskio.c please?

Walid FTITI_O
Senior II
Posted on May 31, 2016 at 15:33

Hi dmbrooks44,

Can you more explain the issue that you get from ''SD_Driver '' declaration in the conditions that lead to that ? (I see you input in this

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=https%3a//my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/CubeMx%20creates%20some%20bugs&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&currentviews=187

).

-Hannibal-

David Brooks
Associate II
Posted on June 01, 2016 at 22:29

My project started out as a copy ofone of theExamples Projects. So various stm32469i_discovery_***.c files are also included in the project, accordingly.Myproject grew from there, making use of other Example Projects involving other peripherals. As various peripherals were added to my project, Ialso reconfigured Cube each time to include the new peripheral. (After all, Cube is the wave of the future.) So, I see there is room for some overlap between the Example Projects (which came from theSTMCube folder, but were not actually generated by Cube???) and Cube-generated code. SoCube adds bsp_driver_sd.c to my project. I assume it does this since I selected the 468i-Disc board from the Cube dropdown menu. But now I get the errors in the attached file. So the whole thing is quite confusing to a new ST user. I realize I don't need to use Cube to run these Examples, but I want to in order to learn it. So how do the stm32469i_discovery_***.c files and bsp_***.c files work together? Or do they? Which takes precedence? I'dbe happy to read any documentation on the subject. I don't think this problem would exist if the Example Projects in the Cube folder were actually generated by Cube.

________________

Attachments :

Compiler_Errors.txt : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtrQ&d=%2Fa%2F0X0000000aY0%2F8cnO6ACfjw9dgPcou9z20P7k9le92s2duESzIdZhPZ8&asPdf=false
stm32cube-t
Senior III
Posted on October 07, 2016 at 16:59

Dear user,

In order for the generated project to compile, STM32CubeMX generates some bsp initialization code.

However, STM32CubeMX does not manage the BSP drivers used in the Cube examples and delivered as part of STM32Cube firmware packages for ST boards only.

Best regards.

GreenGuy
Senior III
Posted on March 14, 2018 at 05:31

This is still occurring (BSP_driver_sd.c in the user/src folder) and there has not been a succinct  answer to the first question.  So:

1) Should CubeMX be adding a board support package file to the src folder?

2) Why there and not in Driver/BSP/(board) folder?

Now a couple more questions:

3) If the user has selected a particular board, then why does CubeMX not pull the relevant files from the appropriate Driver/BSP area in the repository since CubeMX should know from the user choice which board is being used?  Isn't that what computers and good software are good at?

4) Is there a reason why a user would not want to use a board support package that is already done and tested and version controlled?