Page 1 of 1

RTC on STM373 with Chibios 19.1

Posted: Mon Nov 04, 2019 8:45 am
by Stephane
Hello,

I'm migrating projects from versions 17.6 and 18.2 to Chibios 19.1.
And i'm having some trouble...

All projects that use the STM32L496 migrated fine.

The ones that uses the STM32F373 with RTC support are complaining about a lot of things about the RTC.
These projects uses the internal RTC with external crystal.

And while compiling, i obtain the following type of errors:

Code: Select all

In file included from ../../chibios191/os/hal/include/hal_rtc.h:115:0,
                 from ../../chibios191/os/hal/include/hal.h:145,
                 from ../../chibios191/os/hal/src/hal_mmcsd.c:25:
../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h:54:38: warning: "STM32_RTC_STORAGE_SIZE" is not defined, evaluates to 0 [-Wundef]
 #define RTC_HAS_STORAGE             (STM32_RTC_STORAGE_SIZE > 0)
                                      ^
../../chibios191/os/hal/include/hal_rtc.h:131:6: note: in expansion of macro 'RTC_HAS_STORAGE'
 #if (RTC_HAS_STORAGE == TRUE) || defined(__DOXYGEN__)
      ^~~~~~~~~~~~~~~

etc...

../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:535:2: error: #error "missing required RTC handlers definitions in registry"
 #error "missing required RTC handlers definitions in registry"
  ^~~~~
In file included from ../../chibios191/os/hal/ports/STM32/STM32F37x/hal_lld.h:996:0,
                 from ../../chibios191/os/hal/include/hal.h:118,
                 from ../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:29:
../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c: In function 'rtc_lld_init':
../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:585:31: error: 'STM32_RTC_ALARM_EXTI' undeclared (first use in this function); did you mean 'STM32_RTC_PRER_BITS'?
   extiEnableGroup1(EXTI_MASK1(STM32_RTC_ALARM_EXTI) |
                               ^
../../chibios191/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.h:105:44: note: in definition of macro 'EXTI_MASK1'
 #define EXTI_MASK1(line) (uint32_t)(1U << (line))
                                            ^~~~
../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:585:31: note: each undeclared identifier is reported only once for each function it appears in
   extiEnableGroup1(EXTI_MASK1(STM32_RTC_ALARM_EXTI) |
                               ^
../../chibios191/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.h:105:44: note: in definition of macro 'EXTI_MASK1'
 #define EXTI_MASK1(line) (uint32_t)(1U << (line))
                                            ^~~~
../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:586:31: error: 'STM32_RTC_TAMP_STAMP_EXTI' undeclared (first use in this function); did you mean 'STM32_RTC_ALARM_EXTI'?
                    EXTI_MASK1(STM32_RTC_TAMP_STAMP_EXTI) |
                               ^
../../chibios191/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.h:105:44: note: in definition of macro 'EXTI_MASK1'
 #define EXTI_MASK1(line) (uint32_t)(1U << (line))
                                            ^~~~
Compiling hal_spi_lld.c
../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:587:31: error: 'STM32_RTC_WKUP_EXTI' undeclared (first use in this function); did you mean 'STM32_RTC_ALARM_EXTI'?
                    EXTI_MASK1(STM32_RTC_WKUP_EXTI),
                               ^
../../chibios191/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.h:105:44: note: in definition of macro 'EXTI_MASK1'
 #define EXTI_MASK1(line) (uint32_t)(1U << (line))
                                            ^~~~
Compiling hal_st_lld.c
../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:591:3: warning: implicit declaration of function 'STM32_RTC_IRQ_ENABLE'; did you mean 'STM32_LPTIM_CR_ENABLE'? [-Wimplicit-function-declaration]
   STM32_RTC_IRQ_ENABLE();
   ^~~~~~~~~~~~~~~~~~~~
   STM32_LPTIM_CR_ENABLE
   
 etc...


For the migration, i compared/adapted all the common files (chconf.h, halconf.h makefile, mcuconf.h) against the ones in the testhal folder for the STM32F37x.

Then I tried to compile the HAL ADC driver demo for the 373, and it compiles fine.
But if i modify halconf.h, changing HAL_USE_RTC from FALSE to TRUE, i obtain similar errors.

Someone has some ideas of what can be wrong or missing ?

Thanks in advance.

Stephane

Re: RTC on STM373 with Chibios 19.1

Posted: Mon Nov 04, 2019 9:15 am
by Giovanni
Hi,

Moving in "bug reports", it is about STM32_RTC_STORAGE_SIZE not being defined in stm32_registry.h.

You may try to add it and it should work.

Giovanni

Re: RTC on STM373 with Chibios 19.1

Posted: Mon Nov 04, 2019 11:05 am
by Stephane
Hi,

Thanks for the fast answer.

It helps: i have a lot less of error messages, but i always obtains these ones:

Code: Select all

../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:535:2: error: #error "missing required RTC handlers definitions in registry"
 #error "missing required RTC handlers definitions in registry"
  ^~~~~
In file included from ../../chibios191/os/hal/ports/STM32/STM32F37x/hal_lld.h:996:0,
                 from ../../chibios191/os/hal/include/hal.h:118,
                 from ../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:29:
../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c: In function 'rtc_lld_init':
../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:585:31: error: 'STM32_RTC_ALARM_EXTI' undeclared (first use in this function); did you mean 'STM32_RTC_PRER_BITS'?
   extiEnableGroup1(EXTI_MASK1(STM32_RTC_ALARM_EXTI) |
                               ^
../../chibios191/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.h:105:44: note: in definition of macro 'EXTI_MASK1'
 #define EXTI_MASK1(line) (uint32_t)(1U << (line))
                                            ^~~~
../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:585:31: note: each undeclared identifier is reported only once for each function it appears in
   extiEnableGroup1(EXTI_MASK1(STM32_RTC_ALARM_EXTI) |
                               ^
../../chibios191/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.h:105:44: note: in definition of macro 'EXTI_MASK1'
 #define EXTI_MASK1(line) (uint32_t)(1U << (line))
                                            ^~~~
../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:586:31: error: 'STM32_RTC_TAMP_STAMP_EXTI' undeclared (first use in this function); did you mean 'STM32_RTC_ALARM_EXTI'?
                    EXTI_MASK1(STM32_RTC_TAMP_STAMP_EXTI) |
                               ^
../../chibios191/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.h:105:44: note: in definition of macro 'EXTI_MASK1'
 #define EXTI_MASK1(line) (uint32_t)(1U << (line))
                                            ^~~~
../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:587:31: error: 'STM32_RTC_WKUP_EXTI' undeclared (first use in this function); did you mean 'STM32_RTC_ALARM_EXTI'?
                    EXTI_MASK1(STM32_RTC_WKUP_EXTI),
                               ^
../../chibios191/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.h:105:44: note: in definition of macro 'EXTI_MASK1'
 #define EXTI_MASK1(line) (uint32_t)(1U << (line))
                                            ^~~~
../../chibios191/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c:591:3: warning: implicit declaration of function 'STM32_RTC_IRQ_ENABLE'; did you mean 'STM32_LPTIM_CR_ENABLE'? [-Wimplicit-function-declaration]
   STM32_RTC_IRQ_ENABLE();
   ^~~~~~~~~~~~~~~~~~~~
   STM32_LPTIM_CR_ENABLE


If you have more propositions, i'm interessed. :-)

Stephane

Re: RTC on STM373 with Chibios 19.1

Posted: Mon Nov 04, 2019 11:44 am
by Giovanni
Hi,

I need to work on it, I will commit a fix in the afternoon.

Giovanni

Re: RTC on STM373 with Chibios 19.1

Posted: Mon Nov 04, 2019 6:37 pm
by Giovanni
Fixed as bug #1054.

I just test-compiled it.

Giovanni

Re: RTC on STM373 with Chibios 19.1

Posted: Tue Nov 05, 2019 9:14 am
by Stephane
Hi,

Checked now: my projects compile fine now.

And small test with one of my prototype: writing/reading the RTC are ok.

Many thanks !!!

Stephane