stm32duino / STM32RTC

Arduino RTC library for STM32.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid acceptance range of STM32_CORE_VERSION condition

omiguelamado opened this issue · comments

Brief issue description:

  • I'm using a STM32 Nucleo-L476RG and when this RTC lib does not compile at all due to a not full acceptable range of the define variable STM32_CORE_VERSION.

My local files:

  • In my local STM Lib (stm32_def.h), this define is the following:

/**
* @brief STM32 core version number
*/
#define STM32_CORE_VERSION_MAJOR (0x01U) /*!< [31:24] major version */
#define STM32_CORE_VERSION_MINOR (0x09U) /*!< [23:16] minor version */
#define STM32_CORE_VERSION_PATCH (0x00U) /*!< [15:8] patch version */
/*
* Extra label for development:
* 0: official release
* [1-9]: release candidate
* F[0-9]: development
*/
#define STM32_CORE_VERSION_EXTRA (0x00U) /*!< [7:0] extra version */
#define STM32_CORE_VERSION ((STM32_CORE_VERSION_MAJOR << 24U)\
|(STM32_CORE_VERSION_MINOR << 16U)\
|(STM32_CORE_VERSION_PATCH << 8U )\
|(STM32_CORE_VERSION_EXTRA))

Your RTC files:

  • In your RTC.c file, there is the following failed condition:

#if defined(STM32_CORE_VERSION) && (STM32_CORE_VERSION > 0x01090000) &&\ defined(HAL_RTC_MODULE_ENABLED) && !defined(HAL_RTC_MODULE_ONLY)

  • Here, its content is not executed due to the failed condition "STM32_CORE_VERSION > 0x01090000".

My suggestion:

In order to fix that issue,

  • I replaced: STM32_CORE_VERSION > 0x01090000
  • by: STM32_CORE_VERSION >= 0x01090000

Now, this RTC lib works OK in my STM.

Hi @omiguelamado

There is no issue. It is the expected behavior.
STM32 RTC driver has been moved from core to library after the 1.9.0.
1.9.0 includes the rtc.* files.
So change it duplicates rtc.* drivers files which is not expected.
Even if it works it should not be done to avoid any duplicated declaration issue or misalignment.

You can install an older version of the lib (< 1.1.0) or update the STM32 core to have a proper version (latest is 2.2.0).