[riot-devel] shell and putchar

Neil Jones neiljay at gmail.com
Fri Jul 6 16:58:57 CEST 2018


Hi all,

I'm working on improving IRQ support on PIC32 and I'm testing UART Rx using
the shell.

The shell uses putchar, but putchar is buffered and needs a flush, thus
when typing at the console I get no feedback until I press enter (the line
feed gets echo'd and then we get the flush).

I'm surprised other newlib implementations don't see this ?

A flush is probably needed here:

#if !defined(SHELL_NO_ECHO) || !defined(SHELL_NO_PROMPT)
#ifdef MODULE_NEWLIB
/* use local copy of putchar, as it seems to be inlined,
 * enlarging code by 50% */
static void _putchar(int c) {
    putchar(c);
    fflush(STDOUT)   <------- HERE

}
#else
#define _putchar putchar
#endif
#endif

I'm happy to do a PR for this, but this is very core functionality, I don't
want to break anything ??

Cheers,

Neil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20180706/17174507/attachment.html>


More information about the devel mailing list