2019-05-27 12:50 AM
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.
Solved! Go to Solution.
2019-05-27 01:18 AM
I Know now that FW packages has a different release number than the HAL Versions ....
But I think this can be misunderstand, Like I did....
Thank you very much...
2019-05-27 01:18 AM
I Know now that FW packages has a different release number than the HAL Versions ....
But I think this can be misunderstand, Like I did....
Thank you very much...
2019-05-29 07:19 AM
Hi @Leonardo Volponi ,
I confirm your conclusion: FW package version is different from HAL version.
__STM32FXxx_HAL_VERSION is the version of HAL drivers embedded in the STM32CubeFX package you select.
This later embeds other drivers like middleware for example, each one has its own version like the HAL drivers.
In the file STM32Cube_FW_F0_V1.10.0/Release_Notes.html, you will find details about the versions of components embedded in the package for the various versions.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.