Archive 07/10/2020.

TP6 use timers: undefined reference to `timer_read’

didefix

Bonjour,
Ci-dessous message d’erreur lors de la compilation:
jovyan@c63f18715013:~/work/iot-lab-training$ make -C riot/basics/timers all termmake: Entering directory ‘/home/jovyan/work/iot-lab-training/riot/basics/timers’

Building application “timers” for “native” with MCU “native”.

“make” -C /home/jovyan/work/iot-lab-training/riot/RIOT/boards/native
“make” -C /home/jovyan/work/iot-lab-training/riot/RIOT/boards/native/drivers
“make” -C /home/jovyan/work/iot-lab-training/riot/RIOT/core
“make” -C /home/jovyan/work/iot-lab-training/riot/RIOT/cpu/native
“make” -C /home/jovyan/work/iot-lab-training/riot/RIOT/cpu/native/periph
“make” -C /home/jovyan/work/iot-lab-training/riot/RIOT/cpu/native/stdio_native
“make” -C /home/jovyan/work/iot-lab-training/riot/RIOT/cpu/native/vfs
“make” -C /home/jovyan/work/iot-lab-training/riot/RIOT/drivers
“make” -C /home/jovyan/work/iot-lab-training/riot/RIOT/drivers/periph_common
“make” -C /home/jovyan/work/iot-lab-training/riot/RIOT/sys
“make” -C /home/jovyan/work/iot-lab-training/riot/RIOT/sys/auto_init
“make” -C /home/jovyan/work/iot-lab-training/riot/RIOT/sys/xtimer
/home/jovyan/work/iot-lab-training/riot/basics/timers/bin/native/xtimer/xtimer_core.o: In function _xtimer_lltimer_now': xtimer_core.c:(.text._xtimer_lltimer_now+0x19): undefined reference totimer_read’
/home/jovyan/work/iot-lab-training/riot/basics/timers/bin/native/xtimer/xtimer_core.o: In function xtimer_init': xtimer_core.c:(.text.xtimer_init+0x24): undefined reference totimer_init’
/home/jovyan/work/iot-lab-training/riot/basics/timers/bin/native/xtimer/xtimer_core.o: In function _schedule_earliest_lltimer': xtimer_core.c:(.text._schedule_earliest_lltimer+0x95): undefined reference totimer_set_absolute’
/home/jovyan/work/iot-lab-training/riot/basics/timers/bin/native/xtimer/xtimer.o: In function _xtimer_lltimer_now': xtimer.c:(.text._xtimer_lltimer_now+0x19): undefined reference totimer_read’
collect2: error: ld returned 1 exit status
/home/jovyan/work/iot-lab-training/riot/basics/timers/…/…/RIOT/Makefile.include:537: recipe for target ‘/home/jovyan/work/iot-lab-training/riot/basics/timers/bin/native/timers.elf’ failed
make: *** [/home/jovyan/work/iot-lab-training/riot/basics/timers/bin/native/timers.elf] Error 1
make: Leaving directory ‘/home/jovyan/work/iot-lab-training/riot/basics/timers’

ci-dessous le, Makefile, dans le répertoire “~/work/iot-lab-training/riot/basics/timers$”
APPLICATION = timers

BOARD ?= native

Add the required drivers module here

RIOTBASE ?= $(CURDIR)/…/…/RIOT

include $(RIOTBASE)/Makefile.include
USEMODULE += xtimer
et le fichier Main.c

#include <stdio.h>

#include “thread.h”

/* Add xtimer include here /
#include “xtimer.h”
/
Add your thread stack and handler function here */

int main(void)
{
/* Create the thread here */

/* Print main thread messages in a loop here, with 500ms delay between each message */
int counter = 0;
while (1) {
    counter++;
    printf("Message %d from main thread\n", counter);

    /* add 500ms delay */
    xtimer_usleep(500 * US_PER_MS);
}
return 0;

}
~
Je n’arrive pas à trouver le pb. Quelqu’un peut-il aider?
Merci

aabadie2

Bonjour,

Dans le Makefile, la ligne USEMODULE += xtimer doit se trouver avant la ligne include $(RIOTBASE)/Makefile.include. Sinon le module xtimer n’est pas ajouté au build et c’est ce qui provoque l’erreur de compilation.

didefix

Merci. Plus d’erreur