summaryrefslogtreecommitdiff
path: root/bsp/x86/picolib/picolib_stdio.c
blob: 2429a3870cf17b5582f7a9b5e25abfe7c4e9cc15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <rtthread.h>
#include <stdio.h>

static int picolibc_putc(char c, FILE *file)
{
    (void)file;

    if (c == '\n')
    {
        rt_hw_console_output("\r");
    }

    rt_hw_console_output((const char *)&c);
    return c;
}

static FILE __stdio_out = FDEV_SETUP_STREAM(picolibc_putc, NULL, NULL, _FDEV_SETUP_WRITE);

FILE *const stdout = &__stdio_out;
FILE *const stderr = &__stdio_out;