Skip to main content
Visitor II
June 13, 2019
Question

Is there HAL version macro defined somewhere?

  • June 13, 2019
  • 5 replies
  • 2868 views

I need to know HAL library version number during device firmware build process. Is there something like __HAL_VERSION_1_9_0__ or similar defined in the HAL library code?

Thank you

Dan

    This topic has been closed for replies.

    5 replies

    Graduate II
    June 13, 2019

    Perhaps not ideal but

    STM32Cube_FW_L4_V1.14.0\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_hal.c

    /**

     * @brief STM32L4xx HAL Driver version number

      */

    #define STM32L4XX_HAL_VERSION_MAIN  (0x01U) /*!< [31:24] main version */

    #define STM32L4XX_HAL_VERSION_SUB1  (0x0AU) /*!< [23:16] sub1 version */

    #define STM32L4XX_HAL_VERSION_SUB2  (0x00U) /*!< [15:8] sub2 version */

    #define STM32L4XX_HAL_VERSION_RC   (0x00U) /*!< [7:0] release candidate */

    #define STM32L4XX_HAL_VERSION    ((STM32L4XX_HAL_VERSION_MAIN << 24U)\

                       |(STM32L4XX_HAL_VERSION_SUB1 << 16U)\

                       |(STM32L4XX_HAL_VERSION_SUB2 << 8U)\

                       |(STM32L4XX_HAL_VERSION_RC))

    /**

     * @brief Return the HAL revision.

     * @retval version : 0xXYZR (8bits for each decimal, R for RC)

     */

    uint32_t HAL_GetHalVersion(void)

    {

     return STM32L4XX_HAL_VERSION;

    }

    dan2Author
    Visitor II
    June 13, 2019

    Hi Clive,

    Thank you for your prompt response. Why are those version macros defined in C file and not in some HAL header file.

    HAL libs are not 100% compatible between various STM32 families and If I want to do conditional compilation based on HAL lib version I can't do it this way :-(.

    Is there something else I can lean on?

    Perhaps something to consider for the next HAL lib release.

    Regards

    Daniel

    Graduate II
    July 31, 2020

    > Why are those version macros defined in C file and not in some HAL header file.

    Because HAL is developed by brainless code monkeys...

    Visitor II
    July 31, 2020

    I agree with dan2, this is not very useful.

    Graduate II
    July 31, 2020

    As you can see, ST doesn't care! The only thing they are capable of, is randomly choosing few trivial issues and work on a fix for about a year. Anything more complex is beyond their intellectual capabilities and therefore they just ignore it...

    Visitor II
    July 31, 2020

    Practice makes perfect. Lack of it?

    Super User
    July 31, 2020

    .