Skip to main content
st239955_stm1_stmicro_com
Associate III
December 12, 2015
Question

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

  • December 12, 2015
  • 3 replies
  • 1924 views
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?
    This topic has been closed for replies.

    3 replies

    st239955_stm1_stmicro_com
    Associate III
    January 2, 2015
    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.

    Andrei Chichak
    Lead
    December 14, 2015
    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
    st239955_stm1_stmicro_com
    Associate III
    December 14, 2015
    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.