STM32F103 RTC driver

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
pcharest_chibios
Posts: 1
Joined: Sat Oct 27, 2018 1:28 pm

STM32F103 RTC driver

Post by pcharest_chibios »

Hello, tks for your great work, please note I am not an expert developer just a tinkerer I have two issues with the RTC driver on STM32F103:

1)First when using rtcGetTime(&RTCD1, &timespec); when compiling I get code bloat of about 13 Kbytes instead of using the direct method of rtcSTM32GetSecMsec(&RTCD1,&secs,NULL); or direct register method (((uint32_t)(RTCD1.rtc->CNTH) << 16) + RTCD1.rtc->CNTL)).

2)Also when using rtcGetTime(&RTCD1, &timespec) without initializing a chTM object the output of my tm structure seens to be garbage otherwise it is fine this does not make sense to me.

chTMObjectInit(&gett);
chTMStartMeasurementX(&gett);
rtcGetTime(&RTCD1, &timespec);
rtcConvertDateTimeToStructTm(&timespec, &mytime,NULL);
chTMStopMeasurementX(&gett);

Also I have noticed when compiling and linking with arm-none-eabi-gcc-6.3.1 any drive using streams seems to hang a thread but with arm-none-eabi-gcc-7.2.1 everything is fine... I am pretty sure the code bloat has to do with linking to a library any idea?

Philippe
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F103 RTC driver

Post by Giovanni »

Hi,

The driver includes some library code so this could explain both issues (bloat and different behavior on 2 compilers).

If the code size is a concern then I recommend using the direct method.

Giovanni
Post Reply