Archive 07/10/2020.

Le TP6 ne fonctionne pas chez moi?

obausson

Bonjour à tous,
Je pense avoir tout fait ce qui est demandé dans le TP.
Mais, après exécution du Make qui n’affiche pas d’erreur, rien ne s’affiche. Un message devrait s’afficher tous les 0,5s et je n’ai pas le prompt du shell.

contenu de main.c :
#include <stdio.h>

#include “shell.h”

#include “thread.h”
#include “xtimer.h”
static char stack[THREAD_STACKSIZE_MAIN];

/* Include threads header and declare the thread stack */

/* Implement thread handler function here */

static void *thread_handler(void *arg)
{
(void)arg;
puts(“Hello from thread!”);
while (1) {}
return NULL;
}

int main(void)
{
/* Start new threads here /
thread_create(stack, sizeof(stack), THREAD_PRIORITY_MAIN + 1,
0, thread_handler, NULL, “new thread”);
/
Start the shell here */
/*char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
*/
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;

Contenu de makefile:
APPLICATION ?= threading

BOARD ?= native

Add extra modules here

USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
USEMODULE += xtimer

Add extended thread information

DEVELHELP ?= 1

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

include $(RIOTBASE)/Makefile.include

}

Et voici l’affichage dans le terminal :
jovyan@840bdaed91ff:~/work/iot-lab-training$ make -C riot/basics/timers all term
make: 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
text data bss dec hex filename
21255 576 47664 69495 10f77 /home/jovyan/work/iot-lab-training/riot/basics/timers/bin/native/timers.elf
/home/jovyan/work/iot-lab-training/riot/basics/timers/bin/native/timers.elf
RIOT native interrupts/signals initialized.
LED_RED_OFF
LED_GREEN_ON
RIOT native board initialized.
RIOT native hardware initialization complete.

main(): This is RIOT! (Version: 2020.01)

aabadie2

Bonjour,

Dans le TP6, il n’y a pas d’utilisation du shell. Il faut repartir des fichiers présents dans le dossier riot/basics/timers et suivre le notebook.

Dans votre cas, la boucle while dans la fonction main n’est jamais lancée car l’exécution s’arrête à la ligne shell_run (qui est elle même une boucle infinie).
Le thread créé avant de lancer le shell a une priorité inférieure au main thread et il ne lance jamais.

Je constate également que vous ne compilez pas les bons modules (les modules shell/shell_commands/ps/xtimer n’apparaissent dans les lignes make). Donc vous devez probablement modifier les fichiers d’un autre TP mais vous compilez la version à modifier du TP6.

Alexandre

obausson

Merci beaucoup pour votre réponse très claire. Effectivement, les onglets main.c et makefile correspondaient au TP précédent! Et je comprend beaucoup mieux le shell maintenant. Bon dimanche

Togo

Bonjour,
Votre réponse est très utile car il n’est pas indiqué au début de chaque TP le dossier dans lequel on travaille. C’est en lisant le TP en entier qu’on a la révélation.
Je tiens à vous remercier pour ce mooc extraordinaire que je suis en train de suivre qui conduit l’apprenant que je suis (avec quelques bases…) tranquilement à la frontière du matériel et du logiciel.
Certains écrivains ont du mal avec le mot “caractérisTIque”

jcw67

Bonjour,

J’ai aussi cherché, en ouvrant un terminal et en navigant pour trouver le répertoire complet.

En fait, avant l’onglet “TP”, il y a un onglet “Launcher” où le chemin est indiqué :

[EDIT] : Launcher n’y est pas toujours ?
Autre solution : laisser le curseur sur les ‘…’ à gauche : la partie manquante du chemin s’affiche :
image

jc