cancel
Showing results for 
Search instead for 
Did you mean: 

possible bug in F3xx Firmware?

CBerg
Senior

When I compile a simple programm, using the CRC feature I get the following warning:

In file included from ../Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_def.h:30,

                from ../Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_rcc.h:29,

                from ../Core/Inc/stm32f3xx_hal_conf.h:199,

                from ../Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal.h:30,

                from ../Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_crc.c:46:

../Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_crc.c: In function 'HAL_CRC_DeInit':

../Drivers/CMSIS/Device/ST/STM32F3xx/Include/stm32f3xx.h:193:41: warning: overflow in conversion from 'int' to 'uint8_t' {aka 'volatile unsigned char'} changes value from '(int)hcrc->Instance->IDR & -256' to '0' [-Woverflow]

 193 | #define CLEAR_BIT(REG, BIT)  ((REG) &= ~(BIT))

     |                                        ^

../Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_crc.c:203:3: note: in expansion of macro 'CLEAR_BIT'

 203 |  CLEAR_BIT(hcrc->Instance->IDR, CRC_IDR_IDR);

     |  ^~~~~~~~~

Can I ignore that or is that a bug?

Thank you & best regards,

chris

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @CBerg​ ,

Thank you for rising this up.

I confirm this warning that reproduced with the STM32CubeF3 V1.11.3.

This warning impacts several series and already detected with STM32CubeF0 MCU package:

-Woverflow warning caused by HAL CRC function · Issue #17 · STMicroelectronics/STM32CubeF0 · GitHub

This issue is already raised internally with ID 133673

(PS: ID 133673 is an internal tracking number and only for reference, not available outside of ST)

The next release of STM32CubeF3 package contains the fix will be published in the coming days.

Hope my answer helped you!

When your question is answered, please close this topic by choosing Select as Best.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

4 REPLIES 4
Imen.D
ST Employee

Hello @CBerg​ 

Is this issue reproduced when generated your project with CubeMx ?

Which version of CubeF3 and CubeMX used?

I will check this issue and come back to you soon with update.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
CBerg
Senior

I am using STM32CubeIDE 1.10.1 Build: 12716_20220707_0928 (UTC)

It is reproducible. Each time I change something in the .ioc file, let the code generation run and compile it, the warning pops up again

I have no idea, where this comes from, because in

HAL_CRC_DeInit(CRC_HandleTypeDef *hcrc) <stm32fxx_hal_crc.c>

hcrc->Instance->IDR is defined as uint8_t

and in stm32f303x8.h the symbol "CDC_IDR_IDR" is defined as "((uint8_t)0xFFU)"

IMHO both values are uint8_t, no overflow should occur. I have no idea why the compiler asumes, there would be an int involved ...

gbm
Lead III

Get rid of (uint8_t) typecast in the defined constant. Generally #defines with typecasts are not a good idea, but somehow ST loves them.

Hi @CBerg​ ,

Thank you for rising this up.

I confirm this warning that reproduced with the STM32CubeF3 V1.11.3.

This warning impacts several series and already detected with STM32CubeF0 MCU package:

-Woverflow warning caused by HAL CRC function · Issue #17 · STMicroelectronics/STM32CubeF0 · GitHub

This issue is already raised internally with ID 133673

(PS: ID 133673 is an internal tracking number and only for reference, not available outside of ST)

The next release of STM32CubeF3 package contains the fix will be published in the coming days.

Hope my answer helped you!

When your question is answered, please close this topic by choosing Select as Best.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen