42 lines
922 B
C
42 lines
922 B
C
#include <stdio.h>
|
|
#include <sys/types.h>
|
|
|
|
extern void uart_putc(char c);
|
|
extern int uart_getc(void);
|
|
|
|
static int
|
|
board_putc(char c, FILE *file)
|
|
{
|
|
(void) file; /* Not used in this function */
|
|
uart_putc(c); /* Defined by underlying system */
|
|
return c;
|
|
}
|
|
|
|
static int
|
|
board_getc(FILE *file)
|
|
{
|
|
unsigned char c;
|
|
(void) file; /* Not used in this function */
|
|
c = uart_getc(); /* Defined by underlying system */
|
|
return c;
|
|
}
|
|
|
|
static int
|
|
board_flush(FILE *file)
|
|
{
|
|
(void) file; /* Not used in this function */
|
|
return 0;
|
|
}
|
|
|
|
static FILE __stdio = FDEV_SETUP_STREAM(board_putc, board_getc, board_flush, _FDEV_SETUP_RW);
|
|
/*
|
|
* Picolibc requires the application to define these
|
|
* when using stdio in freestanding environments.
|
|
*/
|
|
// FILE * const stdin = NULL;
|
|
// FILE * const stdout = NULL;
|
|
// FILE * const stderr = NULL;
|
|
FILE *const stdin = &__stdio;
|
|
__strong_reference(stdin, stdout);
|
|
__strong_reference(stdin, stderr);
|