[PSR] Konzole u microzedu

Michal Sojka michal.sojka at cvut.cz
Mon Nov 26 19:04:45 CET 2018


Hi all,

replying in English...

On Sun, Nov 25 2018, Jitka Hodná wrote:
> Dobry den ve spolek,
>
> mam takovou otazku. Snayim se prijit na chybu v ukolu 6 a prisla jsem na
> to, ze se ruzne printf vypisuji do ruznych konzoli a ja si v tom chtela
> udelat jasno, jak to tedy funguje. Tedy konkretne, mam Downloadable kernel
> modul projekt, kde jsem v run configuration nastavila allocate console. V
> ni se vypisuji jen printf, ktere jsou primo v entry pointu. Printf v
> service thredu se zas vypisuji do GtkTerm. Funkce toho driveru, co mame
> implementovat, tak jeji printif se mi nevypisuji ani do alokovane konzole
> ve windriveru ani do GtkTerm. Kde takovehle vypisy hledat? Jak to
> funguje?

There are multiple things to consider:

1) Buffering of stdout: stdout is line-buffered. This means the string is pushed out of the
   application buffer to the real output only after printing a new-line
   character ("\n"). Students often forget that.

2) Standard I/O redirection: Under VxWorsk, each kernel task (not RTP
   task) can have standard I/O redirected to somewhere else. By default
   all tasks use the system console (serial line on the board). This
   default can be changed by 1) IDE console redirection (Allocate
   console check box in the Run dialog) or 2) by calling ioTaskStdSet()
   or ioGlobalStdSet(). This is documented at:

       Wind River Documentation > VxWorks, 6.9 > VxWorks Kernel
       Programmer's Guide, 6.9 > Core Technologies > I/O System > Basic
       I/O

   So the main task spawned from the IDE with Allocate console switched
   on have the stdio redirected to the IDE, while the tasks spawned from
   that main task have stdio connected to the serial console.

   I believe that this can be changed by calling ioGlobalStdSet(), but I
   have never tried it.

Best regards,
-Michal Sojka




More information about the PSR mailing list