Hello,
I needed help understanding a problem that I am facing when trying to complete task-04 in the riot-os tutorial posted on github(https://github.com/RIOT-OS/Tutorials/tree/master/task-04)
If I just create a thread that print time every 2 seconds everything works as expected.
see picture.
When I run the shell(the riot os shell module), the time is not printed by the thread and I only see the shell(riot shell) marker. I am using Virtual Box with pepermint linux, and building the app(riot app) for native. (Sorry I dont know how to post code in the forms)
#include <stdio.h>
#include "shell.h" // comes with riot
#include "thread.h"
#include "xtimer.h"
static char stack[THREAD_STACKSIZE_MAIN];
void *print_time(void *arg)
{
uint32_t micros=0;
(void)arg;
while(1)
{
micros = xtimer_now_usec();
printf("Current Time (us) = %d\r\n",micros);
xtimer_sleep(2);
}
return NULL;
}
// unable to print if the shell is running..
int main(void)
{
//char line_buf[SHELL_DEFAULT_BUFSIZE];
puts("This is Task-04\r\n");
printf("Thread Stack Size main=%d\r\n",THREAD_STACKSIZE_MAIN);
printf("Thread priority main=%d\r\n",THREAD_PRIORITY_MAIN);
printf("Thread priority min=%d\r\n",THREAD_PRIORITY_MIN);
printf("Thread priority idle=%d\r\n",THREAD_PRIORITY_IDLE);
//shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
// create thread
thread_create(stack, sizeof(stack),
THREAD_PRIORITY_MAIN-2,
THREAD_CREATE_STACKTEST,
print_time,
NULL, "print_time");
return 0;
}
# This is our app name
APPLICATION = task04
# define our default board
BOARD ?= native # arduino-uno
# RIOT base diractory absolute path
RIOTBASE ?= $(CURDIR)/../RIOT
# commit it is final
CFLAGS += -DDEVELHELP
# change to 0 in final
QUIET += 1
# Modules to includes
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
# use timer
USEMODULE += xtimer
include $(RIOTBASE)/Makefile.include