aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/picolibc-stdio.c
blob: 1d7514ba2389d582d9c6c895b5661ca21d4ee739 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// This file is included in the picolibc build.
// It makes stdio functions available to the C library.

#include <stdio.h>
#include <sys/cdefs.h>

// Defined in the runtime package. Writes to the default console (usually, the
// first UART or an USB-CDC device).
int runtime_putchar(char, FILE*);

// Define stdin, stdout, and stderr as a single object.
// This object must not reside in ROM.
static FILE __stdio = FDEV_SETUP_STREAM(runtime_putchar, NULL, NULL, _FDEV_SETUP_WRITE);

// Define the underlying structs for stdin, stdout, and stderr.
FILE *const stdin = &__stdio;
__strong_reference(stdin, stdout);
__strong_reference(stdin, stderr);