STMicroelectronics / STM32CubeU0

STM32Cube MCU Full Package for the STM32U0 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST)
https://www.st.com/en/embedded-software/stm32cubeu0.html
Other
0 stars 1 forks source link

warning: unused variable in stm32u0xx_hal_rtc.h #3

Open CanastraRF opened 4 weeks ago

CanastraRF commented 4 weeks ago

Hi In File stm32u0xx_hal_rtc.h are the following macros:

**#define __HAL_RTC_WRITEPROTECTION_DISABLE(HANDLE)

define __HAL_RTC_WRITEPROTECTION_ENABLE(HANDLE)

define __HAL_RTC_DAYLIGHT_SAVING_TIME_ADD1H(HANDLE, BKP)

define __HAL_RTC_DAYLIGHT_SAVING_TIME_SUB1H(HANDLE, BKP)

define __HAL_RTC_ALARMA_ENABLE(HANDLE)

define __HAL_RTC_ALARMA_DISABLE(HANDLE)

define __HAL_RTC_ALARMB_ENABLE(HANDLE)

define __HAL_RTC_ALARMB_DISABLE(HANDLE)

define HAL_RTC_ALARM_ENABLE_IT(HANDLE, INTERRUPT__)

define HAL_RTC_ALARM_DISABLE_IT(HANDLE, INTERRUPT__)

define HAL_RTC_ALARM_GET_IT(HANDLE, INTERRUPT__)

define __HAL_RTC_ALARM_GET_IT_SOURCE(HANDLE, INTERRUPT)

define HAL_RTC_ALARM_GET_FLAG(HANDLE, FLAG__)

define HAL_RTC_ALARM_CLEAR_FLAG(HANDLE, FLAG__)**

that access the RTC directly and not with HANDLE. So we get lot of warning: unused variable.

Please use (HANDLE)->Instance->... instead of RTC->... as in all other cubes (F0-F4, G0,G4,L0-F4) sources.

ALABSTM commented 3 weeks ago

Hi @CanastraRF,

Would you please specify the compiler you are using, its version and the enabled flags?

Thanks,

CanastraRF commented 3 weeks ago

Hi We've code like the following:

static RTC_TimeTypeDef * RTC_HandleGet( void ); void RTC_AlarmAEnable(void);

RTC_TimeTypeDef g_hRTC;

static RTC_TimeTypeDef * RTC_HandleGet( void ) { return &g_hRTC; }

void RTC_AlarmAEnable(void) { RTC_TimeTypeDef * const hRTC = RTC_HandleGet(); __HAL_RTC_ALARMA_ENABLE( hRTC ); }

The warning is with GCC, ARMCLANG, VC++, PCLint, ... There is no warning with STM32F0, STM32F1, STM32F2, STM32F3, STM32F4, STM32L0, STM32L1, STM32L4, STM32G0, STM32G4 Cube Files

What do you mean with enabled flags?

"-Wunused-variable" is a widely used warning.

ALABSTM commented 2 weeks ago

Hi @CanastraRF,

You point has been logged into an internal tracker. Let's wait for the feedback of the development teams.

With regards,

ALABSTM commented 2 weeks ago

ST Internal Reference: 184768