Overcoming a 256 bytes console/uart limit

Schweikhardt, Jens (TSPCE3-TL4) Jens.Schweikhardt at tesat.de
Wed Aug 26 09:36:21 UTC 2020


Hello world\n

I'm observing a 256 byte input limit with RTEMS 5 on riscv that I don't know how to overcome.
We are using the RTEMS console driver and newlib stdio.
The effect is that an fgets() appears to only accept 256 characters, specifically if we connect via
picocom on a Linux box, we can type exactly 256 chars and then no more characters are accepted.
My first guess was that stdio buffers are 256 byte by default, which they seem to be judging from
grepping for BUFSIZ. Then using setvbuf should be the way to increase their size. But setvbuf had no effect.
Next guess was that it is a limit of picocom. So we tried using Python with pyserial to send data.
Same problem.

Here's a complete RTEMS application that has this issue. How can we increase the input buffer size?

#include <rtems.h>
#include <stdio.h>
#include <string.h>
/*
* RTEMS OS Configuration definitions
*/
#define CONFIGURE_INIT
#define CONFIGURE_INIT_TASK_STACK_SIZE 24576
#define CONFIGURE_INIT_TASK_ATTRIBUTES     RTEMS_FLOATING_POINT
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MAXIMUM_DRIVERS                      10
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS               2

#include <rtems/shellconfig.h>
#include <rtems/confdefs.h>

rtems_task Init(rtems_task_argument aUnused);

rtems_task Init(rtems_task_argument aUnused) {
    char    i_buf[1536];
    char    o_buf[1536];

    printf("Welcome!\n");
    if (setvbuf(stdin, i_buf, _IONBF, sizeof i_buf) != 0) {
        printf("setvbuf i buf failed.\n");
    }
    if (setvbuf(stdout, o_buf, _IONBF, sizeof o_buf) != 0) {
        printf("setvbuf o buf failed.\n");
    }
    rtems_task_wake_after(10);
    fflush(stdout);

    for (;;) {
        printf(">> ");
        char    command_line[1536];
        if (fgets(command_line, sizeof command_line, stdin) == NULL) {
            printf("fgets returned NULL\n");
            break;
        }

        printf("%zu bytes: %s\n", strlen(command_line), command_line);
    }

    (void) rtems_task_delete(RTEMS_SELF);
}



________________________________

Tesat-Spacecom GmbH & Co. KG
Sitz: Backnang; Registergericht: Amtsgericht Stuttgart HRA 270977
Persoenlich haftender Gesellschafter: Tesat-Spacecom Geschaeftsfuehrungs GmbH;
Sitz: Backnang; Registergericht: Amtsgericht Stuttgart HRB 271658;
Geschaeftsfuehrung: Dr. Marc Steckling, Kerstin Basche, Ralf Zimmermann

[banner]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20200826/05f877ce/attachment.html>


More information about the users mailing list