initial commit

This commit is contained in:
2026-01-27 20:45:47 +01:00
commit 1e5eb44ca9
53 changed files with 11048 additions and 0 deletions

41
port/picolibc/port.c Normal file
View File

@@ -0,0 +1,41 @@
#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);