Page 1 of 1

rtcGetTimeTm undefined reference ?!

Posted: Wed Dec 18, 2013 5:39 pm
by Stomper85
I dont get what is wrong.... here is the Source of my main.c

Code: Select all

#include "ch.h"
#include "hal.h"
#include "chrtclib.h"

RTCTime timespec;
struct tm thetime;

int main(void) {


  halInit();
  chSysInit();


  rtcGetTimeTm(&RTCD1, &thetime);

.
.
.
}


And I get the following error from compiler: undefined reference to `rtcGetTimeTm'

But it IS declared in the chrtclib.h Also it is defined in the chrtclib.c
If i right click "Open declaration" it is pointing me exactly to the c file - but why does the compiler not find it ?!

Best regards
Stomper

Re: rtcGetTimeTm undefined reference ?!

Posted: Wed Dec 18, 2013 6:02 pm
by Stomper85
Got it

You have to enable the lib in the makefile

Code: Select all

# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(PORTSRC) \
       $(KERNSRC) \
       $(TESTSRC) \
       $(HALSRC) \
       $(PLATFORMSRC) \
       $(BOARDSRC) \
       $(CHIBIOS)/os/various/evtimer.c \
       $(CHIBIOS)/os/various/syscalls.c \
       $(CHIBIOS)/os/various/chrtclib.c \  /* <- Add this one for rtc utils */
       main.c


I didn“t catch that "various" parts are not part of the core and that I have to add it manually.
But by the way: It would help a little for new users if it would stand also on this page (http://chibios.sourceforge.net/html/gro ... tclib.html), where the tool/driver is discribed. I found this page first and dried on and on until i found the other page telling me that it has to be added manually.