Trivia Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Posts: 693
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 9 times
Been thanked: 99 times

Trivia  Topic is solved

Postby steved » Wed Jun 17, 2020 1:24 pm

1. In current releases:
STM32/LLD/RTCv2/hal_rtc_lld.c line 572 duplicated:


2. In trunk:
trunk\os\common\ports\ARM\compilers\GCC\chcoreasm.S (and counterparts under the ARMCMx path, at least)
Two offsets are defined:

#define CURRENT_OFFSET 12 /* New definition */
#define CONTEXT_OFFSET 12 /* Existing definition */

CURRENT_OFFSET isn't used, which may be intentional

(looking at port_switch_arm(), which has:

str sp, [r1, #CONTEXT_OFFSET]
ldr sp, [r0, #CONTEXT_OFFSET]

maybe one should be CURRENT_OFFSET?

...and a possible small addition:
3. On the 32F0 series (at least) LSI on-chip clock is 40kHz. So could the following "helper", which adjusts the RTC prescaler, be added in an appropriate place?

#define STM32_RTC_PRESA_VALUE 40 /* Used when clock is LSI */

I've added it to os\hal\ports\STM32\STM32F0xx\hal_lld.h for the F0 series, as attached.
(4.78 KiB) Downloaded 3 times

User avatar
Site Admin
Posts: 12871
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 717 times
Been thanked: 596 times

Re: Trivia

Postby Giovanni » Fri Jun 26, 2020 9:18 am



PRER is duplicated because this sentence in the manual: "This register must be written in initialization mode only. The initialization must be performed
in two separate write accesses.".

I am not sure it is what they meant but it works.


No, it is CONTEXT_OFFSET. The other constant is there because patterns and not used, it is used in other ports.


What would be the behavior when STM32_RTCSEL != STM32_RTCSEL_LSI? it would be undefined. Anyway, RTC configuration is not something the HAL driver does, we should update all of them.


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 4 guests