STMicroelectronics / STM32CubeG0

STM32Cube MCU Full Package for the STM32G0 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
Other
164 stars 75 forks source link

Clang warnings in stm32g0xx_hal_rcc.c #22

Closed SHWarema closed 2 years ago

SHWarema commented 2 years ago

When compiling stm32g0xx_hal_rcc.c with the ARM Compiler 6 (Clang/LLVM) the following warnings are generated: image

Maybe use this instead:

         /* Configure the main PLL clock source, multiplication and division factors. */
#if defined(RCC_PLLQ_SUPPORT)
         __HAL_RCC_PLL_CONFIG(RCC_OscInitStruct->PLL.PLLSource,
                              RCC_OscInitStruct->PLL.PLLM,
                              RCC_OscInitStruct->PLL.PLLN,
                              RCC_OscInitStruct->PLL.PLLP,
                              RCC_OscInitStruct->PLL.PLLQ,
                              RCC_OscInitStruct->PLL.PLLR);
#else
         __HAL_RCC_PLL_CONFIG(RCC_OscInitStruct->PLL.PLLSource,
                              RCC_OscInitStruct->PLL.PLLM,
                              RCC_OscInitStruct->PLL.PLLN,
                              RCC_OscInitStruct->PLL.PLLP,
                              RCC_OscInitStruct->PLL.PLLR);
#endif
RKOUSTM commented 2 years ago

Hi @SHWarema,

Thank you for your report. We tried to reproduce the issue you have described using an example RCC in the latest STM32CubeG0 v1.5.0 package, with no success. Regarding the support of the ARM Keil V6 compiler, you need to configure the options target of your application as follows: image image

The following updates are proposed in the Header or C files, if they do not currently apply:

An update is proposed in Header or C files if not existed:

-#if   defined ( __CC_ARM )
+#if defined ( __CC_ARM ) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
-#if   defined ( __GNUC__ )
+#if defined (GNUC) && !defined (__CC_ARM) && !(defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))

I really hope you could find the root cause of this issue and, ideally, solve it. Anyway, if you ever become able to reproduce systematically the faulty behavior and find out that the problem is related to our middleware, do not hesitate to recontract me. We could reopen this issue again.

Thank you again for your report.

With regards,

SHWarema commented 2 years ago

Hi @RKOUSTM!

Well, to be able to see that warning, you have to enable the "All Warnings" option instead of the "AC5-like warnings" option. I'm sorry for the incomplete information provided by me!

Best regards