cancel
Showing results for 
Search instead for 
Did you mean: 

Lots of ''unused parameter'' warnings when compiling cube hal

Posted on December 12, 2015 at 23:45

Using cube hal in SW4STM32 with -Wall -Wextra give lots of warnings like:

STM32Cube_FW_F4_V1.9.0/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c: In function 'HAL_SPI_MspInit': STM32Cube_FW_F4_V1.9.0/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c:267:49: warning: unused parameter 'hspi' [-Wunused-parameter] __weak void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)

Could you please fix that in the next version of cube hal?
3 REPLIES 3
Posted on January 02, 2016 at 19:49

In cube hal F4 V1.10.0, it is fixed e.g. in `stm32f4xx_spi.c` but unfortunately still happened in e.g.:

  • cmsis_os.c
  • stm32f4xx_hal_adc_ex.c
  • stm32f4xx_hal_flash.c
  • stm32f4xx_hal_gpio.c
  • stm32f4xx_hal_tim.c
So I still have to patch the cube hal sources to make my projects build with zero warnings.

Posted on December 14, 2015 at 02:27

Your wish is their command...actually it's already been fixed.

In 1.0 that routine reads:

__weak 
void
HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hspi);
/* NOTE : This function Should not be modified, when the callback is needed,
the HAL_SPI_MspInit could be implemented in the user file
*/
}

Update your CubeMX. Andrei from The Great White North
Posted on December 14, 2015 at 14:23

Much thanx for that info, I'll check it out.

And hopefully they have also fixed their UNUSED() macro ([DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/How%20to%20enable%20a%20timer%20using%20cube%20hal&currentviews=40]see this post).

Joe.