2017-01-16 06:19 AM
Is there a way to get STM32CubeMX to add the BSP when it generates code?
2017-01-16 06:33 AM
Hello
doe.john.016
,BSP library is
not supported in the code generation
by CubeMx, it should be added manually by the user, to the project generated under project's workspace.I forward your request to our CubeMx team for further investigation.
Regards
Imen
2017-01-24 04:45 AM
Hello
doe.john.016
,As Imen already said, BSP is not supported in the CubeMX code generation.
However, a study is in progress to implement BSP in CubeMX in order to generate it automatically. This is the first step of the topic, it remains lot of things to do (development, integration, validation..) so it won't be implemented soon and I can't give you any delivery date for the moment.
BR. Eric
2017-01-25 09:08 PM
,
,
It was easy enough.
I copied the BSP directory from STM32Cube/Repository/STM32Cube_FW_F7_V1.6.0/Drivers/BSP/STM32F769I-Discovery/ into the Drivers/BSP directory of my project. Added that folder to the includes search path
Then I copied the Utilties folder from STM32Cube/Repository/STM32Cube_FW_F7_V1.6.0/Utilities/ into my project, and added it to the includes search path
I used STM32CubeMX to generate code with only the default settings except for the clocks, and what I wanted turned on, which was i2c, spi, uart, and a couple of timer/counters.
Clock settings:
, RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE,
,
, RCC_OscInitStruct.HSEState = RCC_HSE_ON,,
, RCC_OscInitStruct.LSEState = RCC_LSE_ON,,
, RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON,,
, RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE,,
, RCC_OscInitStruct.PLL.PLLM = 25,,
, RCC_OscInitStruct.PLL.PLLN = 432,,
, RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2,,
, RCC_OscInitStruct.PLL.PLLQ = 4,If you're going to use the SDRAM, the documentation says don't go faster than 200mhz so change the PLL M from 432 to 400 and you will get 200mhz sysclock
Then I added ♯ include ''stm32f769i_discovery.h'' and tried to build. I let the linker tell me which HAL driver files were needed one by one. Added them to Drivers/STM32F7xx_HAL_Driver/Inc/
stm32f7xx_hal_cortex.h
,
stm32f7xx_hal_dcmi_ex.h,
stm32f7xx_hal_dcmi.h,
stm32f7xx_hal_def.h,
stm32f7xx_hal_dfsdm.h,
stm32f7xx_hal_dma_ex.h,
stm32f7xx_hal_dma.h,
stm32f7xx_hal_dma2d.h,
stm32f7xx_hal_dsi.h,
stm32f7xx_hal_flash_ex.h,
stm32f7xx_hal_flash.h,
stm32f7xx_hal_gpio_ex.h,
stm32f7xx_hal_gpio.h,
stm32f7xx_hal_i2c_ex.h,
stm32f7xx_hal_i2c.h,
stm32f7xx_hal_i2s.h,
stm32f7xx_hal_lptim.h,
stm32f7xx_hal_ltdc_ex.h,
stm32f7xx_hal_ltdc.h,
stm32f7xx_hal_mmc.h,
stm32f7xx_hal_pwr_ex.h,
stm32f7xx_hal_pwr.h,
stm32f7xx_hal_qspi.h,
stm32f7xx_hal_rcc_ex.h,
stm32f7xx_hal_rcc.h,
stm32f7xx_hal_sai_ex.h,
stm32f7xx_hal_sai.h,
stm32f7xx_hal_sd.h,
stm32f7xx_hal_sdram.h,
stm32f7xx_hal_spi.h,
stm32f7xx_hal_sram.h,
stm32f7xx_hal_tim_ex.h,
stm32f7xx_hal_tim.h,
stm32f7xx_hal_uart_ex.h,
stm32f7xx_hal_uart.h,
stm32f7xx_hal.h,
stm32f7xx_ll_adc.h,
stm32f7xx_ll_bus.h,
stm32f7xx_ll_cortex.h,
stm32f7xx_ll_crc.h,
stm32f7xx_ll_dac.h,
stm32f7xx_ll_dma.h,
stm32f7xx_ll_dma2d.h,
stm32f7xx_ll_exti.h,
stm32f7xx_ll_fmc.h,
stm32f7xx_ll_gpio.h,
stm32f7xx_ll_i2c.h,
stm32f7xx_ll_iwdg.h,
stm32f7xx_ll_lptim.h,
stm32f7xx_ll_pwr.h,
stm32f7xx_ll_rcc.h,
stm32f7xx_ll_rng.h,
stm32f7xx_ll_rtc.h,
stm32f7xx_ll_sdmmc.h,
stm32f7xx_ll_spi.h,
stm32f7xx_ll_system.h,
stm32f7xx_ll_tim.h,
stm32f7xx_ll_usart.h,
stm32f7xx_ll_usb.h,
stm32f7xx_ll_utils.h,
stm32f7xx_ll_wwdg.hI'm sure some got added that didn't need to be because I just did some basic pattern matching and was being lazy. don't forget to add the corresponding .c file to the Src folder. Don't just copy *.c because some template files will get copied raw and your build will probably fail.
The whole board support package, with being able to print to the screen, has these includes:
♯ include ''stm32f769i_discovery.h''
,
♯ include ''stm32f769i_discovery_sdram.h'',
♯ include ''stm32f769i_discovery_lcd.h'',
♯ include ''stm32f769i_discovery_qspi.h'',
♯ include ''stm32f769i_discovery_ts.h'',
♯ include ''stm32f769i_discovery_audio.h'',
♯ include ''stm32f769i_discovery_sd.h'',
♯ include ''stm32f769i_discovery_eeprom.h'',
♯ include ''lcd_log.h''Ok now that the includes and source files are in place, we have to turn the modules on. Keep a copy of this file because there's no place for USER CODE in it and the STM32CubeMX will clobber it if you generate new code.
from stm32f7xx_hal_conf.h:
/* ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ Module Selection ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ ♯ */
,
/**,
, * @brief This is the list of modules to be used in the HAL driver,
, */,
♯ define HAL_MODULE_ENABLED ,,/* ♯ define HAL_ADC_MODULE_ENABLED , , */
,
,/* ♯ define HAL_CAN_MODULE_ENABLED , , */,
,/* ♯ define HAL_CEC_MODULE_ENABLED , , */,
,/* ♯ define HAL_CRC_MODULE_ENABLED , , */,
,/* ♯ define HAL_CRYP_MODULE_ENABLED , , */,
,/* ♯ define HAL_DAC_MODULE_ENABLED , , */,
, ♯ define HAL_DCMI_MODULE_ENABLED,
, ♯ define HAL_DMA2D_MODULE_ENABLED,
,/* ♯ define HAL_ETH_MODULE_ENABLED , , */,
,/* ♯ define HAL_NAND_MODULE_ENABLED , , */,
,/* ♯ define HAL_NOR_MODULE_ENABLED , , */,
, ♯ define HAL_SRAM_MODULE_ENABLED,
, ♯ define HAL_SDRAM_MODULE_ENABLED,
,/* ♯ define HAL_HASH_MODULE_ENABLED , , */,
, ♯ define HAL_I2S_MODULE_ENABLED,
,/* ♯ define HAL_IWDG_MODULE_ENABLED , , */,
, ♯ define HAL_LPTIM_MODULE_ENABLED,
, ♯ define HAL_LTDC_MODULE_ENABLED,
, ♯ define HAL_QSPI_MODULE_ENABLED,
,/* ♯ define HAL_RNG_MODULE_ENABLED , , */,
,/* ♯ define HAL_RTC_MODULE_ENABLED , , */,
, ♯ define HAL_SAI_MODULE_ENABLED,
, ♯ define HAL_SD_MODULE_ENABLED,
, ♯ define HAL_MMC_MODULE_ENABLED,
,/* ♯ define HAL_SPDIFRX_MODULE_ENABLED , , */,
, ♯ define HAL_SPI_MODULE_ENABLED,
, ♯ define HAL_TIM_MODULE_ENABLED,
, ♯ define HAL_UART_MODULE_ENABLED,
,/* ♯ define HAL_USART_MODULE_ENABLED , , */,
,/* ♯ define HAL_IRDA_MODULE_ENABLED , , */,
,/* ♯ define HAL_SMARTCARD_MODULE_ENABLED , , */,
,/* ♯ define HAL_WWDG_MODULE_ENABLED , , */,
,/* ♯ define HAL_PCD_MODULE_ENABLED , , */,
,/* ♯ define HAL_HCD_MODULE_ENABLED , , */,
, ♯ define HAL_DFSDM_MODULE_ENABLED,
, ♯ define HAL_DSI_MODULE_ENABLED,
,/* ♯ define HAL_JPEG_MODULE_ENABLED , , */,
,/* ♯ define HAL_MDIOS_MODULE_ENABLED , , */,
,/* ♯ define HAL_SMBUS_MODULE_ENABLED , , */,
, ♯ define HAL_MMC_MODULE_ENABLED,
, ♯ define HAL_GPIO_MODULE_ENABLED,
, ♯ define HAL_DMA_MODULE_ENABLED,
, ♯ define HAL_RCC_MODULE_ENABLED,
, ♯ define HAL_FLASH_MODULE_ENABLED,
, ♯ define HAL_PWR_MODULE_ENABLED,
, ♯ define HAL_I2C_MODULE_ENABLED,
, ♯ define HAL_CORTEX_MODULE_ENABLEDand that's how i got the BSP working on my STM32F769I-Discovery using SW4STM32.
2017-01-26 04:53 AM
I think adding BSP means copying BSP directory to Drivers and updating include path in project (I'm using System Workbench, that's done in project's 'Properties'). The BSP directory should only contain relevant board, e.g. 'STM32746G-Discovery' directory.
Utilities is not needed, that's for sure not BSP, it contains e.g. audio files. Drivers/STM32F7xx_HAL_Driver/Inc/ should already contain relevant files, that directory is generated by CubeMX.
2017-01-26 04:59 AM
Utilities contains Log and Fonts
The CubeMX only populates the include and source directories by what is chosen. it does not install the entire hal library.
2017-07-17 01:05 AM
Found this really helpful! Appreciate it!