Question for ST, MCD Application Team
What the __STM32F?xx_HAL_VERSION constant, defined in stm32f?xx_hal.c (where ? is STM32 cpu series) is for ?
I would like to use this constant to check at compile time and display at run time what is the HAL library used in the firmware...
But with my surprise, I discovered that the values defined is totally misaligned with the HAL version number....
just to report here some example:
Real HAL Version: STM32Cube_FW_F0_V1.10.0 --> __STM32F3xx_HAL_VERSION is defined as : 0x01070100
and the file stm32f0xx_hal.c Contains:
.....
.....
/**
* @brief STM32F0xx HAL Driver version number V1.7.1
*/
#define __STM32F0xx_HAL_VERSION_MAIN (0x01) /*!< [31:24] main version */
#define __STM32F0xx_HAL_VERSION_SUB1 (0x07) /*!< [23:16] sub1 version */
#define __STM32F0xx_HAL_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */
#define __STM32F0xx_HAL_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32F0xx_HAL_VERSION ((__STM32F0xx_HAL_VERSION_MAIN << 24U)\
|(__STM32F0xx_HAL_VERSION_SUB1 << 16U)\
|(__STM32F0xx_HAL_VERSION_SUB2 << 8U )\
|(__STM32F0xx_HAL_VERSION_RC))
....
....
Real HAL Version: STM32Cube_FW_F1_V1.7.0 --> __STM32F3xx_HAL_VERSION is defined as : 0x01010300
and the file stm32f1xx_hal.c Contains:
.....
.....
/**
* @brief STM32F1xx HAL Driver version number V1.1.3
*/
#define __STM32F1xx_HAL_VERSION_MAIN (0x01U) /*!< [31:24] main version */
#define __STM32F1xx_HAL_VERSION_SUB1 (0x01U) /*!< [23:16] sub1 version */
#define __STM32F1xx_HAL_VERSION_SUB2 (0x03U) /*!< [15:8] sub2 version */
#define __STM32F1xx_HAL_VERSION_RC (0x00U) /*!< [7:0] release candidate */
#define __STM32F1xx_HAL_VERSION ((__STM32F1xx_HAL_VERSION_MAIN << 24)\
|(__STM32F1xx_HAL_VERSION_SUB1 << 16)\
|(__STM32F1xx_HAL_VERSION_SUB2 << 8 )\
|(__STM32F1xx_HAL_VERSION_RC))
Real HAL Version: STM32Cube_FW_F3_V1.10.0 --> __STM32F3xx_HAL_VERSION is defined as : ox01050200
and the file stm32f3xx_hal.c Contains:
.....
.....
/**
* @brief STM32F3xx HAL Driver version number V1.5.2
*/
#define __STM32F3xx_HAL_VERSION_MAIN (0x01U) /*!< [31:24] main version */
#define __STM32F3xx_HAL_VERSION_SUB1 (0x05U) /*!< [23:16] sub1 version */
#define __STM32F3xx_HAL_VERSION_SUB2 (0x02U) /*!< [15:8] sub2 version */
#define __STM32F3xx_HAL_VERSION_RC (0x00U) /*!< [7:0] release candidate */
#define __STM32F3xx_HAL_VERSION ((__STM32F3xx_HAL_VERSION_MAIN << 24U)\
|(__STM32F3xx_HAL_VERSION_SUB1 << 16U)\
|(__STM32F3xx_HAL_VERSION_SUB2 << 8U )\
|(__STM32F3xx_HAL_VERSION_RC))
and so on, all the other values I checked are different from the real version number reported for the HAL packages ....
Could you please explain why there is this misalignment between the official HAL version number and the value in the defined constant that, I think, should be exactly the same value ?
Thank you very much in advance for your reply.
Best regards
Leonardo.
