cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32L081xx] __HAL_RCC_AES_CLK_ENABLE missing

ISzik.1
Associate

Hi all,

I generated code in STM32CubeMX for STM32L081CBTx controller with AES enabled.

I built the generated code (without modification) in STM32CubeIDE, but it failed with warning:

../Core/Src/stm32l0xx_hal_msp.c: In function 'HAL_CRYP_MspInit':
../Core/Src/stm32l0xx_hal_msp.c:94:5: warning: implicit declaration of function '__HAL_RCC_AES_CLK_ENABLE'; did you mean '__HAL_RCC_ADC1_CLK_ENABLE'? [-Wimplicit-function-declaration]

and error:

../Core/Src/stm32l0xx_hal_msp.c:94: undefined reference to `__HAL_RCC_AES_CLK_ENABLE'

because in stm32l0xx_hal_rcc_ex.h __HAL_RCC_AES_CLK_ENABLE is not defined for STM32L081xx controllers.

Here is the relevant code:

#if defined(STM32L062xx) || defined(STM32L063xx)|| defined(STM32L082xx) || defined(STM32L083xx) || defined(STM32L041xx) || defined(STM32L021xx)
#define __HAL_RCC_AES_CLK_ENABLE()   do { \
                                        __IO uint32_t tmpreg; \
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_CRYPEN);\
                                        /* Delay after an RCC peripheral clock enabling */ \
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_CRYPEN);\
                                        UNUSED(tmpreg); \
                                      } while(0)

I have not dug deep into the datasheets and register descriptions yet, so I'm not sure what the proper solution is, but in the stm32l081xx.h RCC->AHBENR and RCC_AHBENR_CRYPEN are both defined, so just adding this family to the #if line is enough for successful build.

(I don't have hardware to test it.)

#if defined(STM32L062xx) || defined(STM32L063xx)|| defined(STM32L081xx) || defined(STM32L082xx) || defined(STM32L083xx) || defined(STM32L041xx) || defined(STM32L021xx)

1 ACCEPTED SOLUTION

Accepted Solutions
Khouloud ZEMMELI
ST Employee

Bug confirmed in the ​stm32l0xx_hal_rcc_ex.h and reported .

It will be fixed by the Hal Team.

Best Regards,

Khouloud

View solution in original post

2 REPLIES 2
Khouloud ZEMMELI
ST Employee

Hello @István Szikra​ 

Thanks for the feedback , it will be internally checked.

Best Regards,

Khouloud​

Khouloud ZEMMELI
ST Employee

Bug confirmed in the ​stm32l0xx_hal_rcc_ex.h and reported .

It will be fixed by the Hal Team.

Best Regards,

Khouloud