cancel
Showing results for 
Search instead for 
Did you mean: 

Is there HAL version macro defined somewhere?

dan2
Associate II

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

9 REPLIES 9

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;

}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dan2
Associate II

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

G A
Associate II

I agree with dan2, this is not very useful.

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

Because HAL is developed by brainless code monkeys...

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...

S.Ma
Principal

Practice makes perfect. Lack of it?

0693W000003BsX3QAK.jpg

This is the picture that come in my mind.... and I had to use a PC to push it out as on smartphone the upload button is behind the glass as the HAL version is in the C file...

How about the CubeIDE version in a header file?

Pavel A.
Evangelist III

.