diff options
Diffstat (limited to 'os/src')
-rw-r--r-- | os/src/fprintf.c | 14 | ||||
-rw-r--r-- | os/src/fstat.c | 8 | ||||
-rw-r--r-- | os/src/init.c | 2 | ||||
-rw-r--r-- | os/src/isatty.c | 8 | ||||
-rw-r--r-- | os/src/printf.c | 14 | ||||
-rw-r--r-- | os/src/sbrk.c | 3 | ||||
-rw-r--r-- | os/src/sprintf.c | 2 |
7 files changed, 48 insertions, 3 deletions
diff --git a/os/src/fprintf.c b/os/src/fprintf.c new file mode 100644 index 0000000..10d34e7 --- /dev/null +++ b/os/src/fprintf.c @@ -0,0 +1,14 @@ +#include <reent.h> +#include <stdio.h> +#include <stdarg.h> +#include <osdebug.h> + +int fprintf(FILE * file, const char * fmt, ...) { + int r; + va_list ap; + DBGOUT("fprintf(%p, %p, ...)\r\n", file, fmt); + va_start(ap, fmt); + r = _vfprintf_r(_impure_ptr, file, fmt, ap); + va_end(ap); + return r; +} diff --git a/os/src/fstat.c b/os/src/fstat.c new file mode 100644 index 0000000..a756206 --- /dev/null +++ b/os/src/fstat.c @@ -0,0 +1,8 @@ +#include <reent.h> +#include <sys/stat.h> +#include "osdebug.h" + +int _fstat_r(struct _reent * ptr, int fildes, struct stat * buf) { + DBGOUT("_fstat_r(%p, %d, %p)\r\n", ptr, fildes, buf); + return 0; +} diff --git a/os/src/init.c b/os/src/init.c index bb3a6fb..070fac1 100644 --- a/os/src/init.c +++ b/os/src/init.c @@ -3,7 +3,6 @@ extern void __libc_init_array(); extern void __libc_fini_array(); -extern void __main(); extern int main(int, char **, char **); extern void BoardEarlyInit(); extern void BoardLateInit(); @@ -22,6 +21,7 @@ void _start() { BoardEarlyInit(); BoardConsoleInit(); BoardConsolePuts("uC-sdk - booting."); +// __sinit(_impure_ptr); __libc_init_array(); BoardLateInit(); atexit(__libc_fini_array); diff --git a/os/src/isatty.c b/os/src/isatty.c new file mode 100644 index 0000000..baf78e4 --- /dev/null +++ b/os/src/isatty.c @@ -0,0 +1,8 @@ +#include <unistd.h> +#include <reent.h> +#include "osdebug.h" + +int _isatty_r(struct _reent * ptr, int fildes) { + DBGOUT("_isatty_r(%p, %d)\r\n", ptr, fildes); + return 0; +} diff --git a/os/src/printf.c b/os/src/printf.c new file mode 100644 index 0000000..599857c --- /dev/null +++ b/os/src/printf.c @@ -0,0 +1,14 @@ +#include <reent.h> +#include <stdio.h> +#include <stdarg.h> +#include <osdebug.h> + +int printf(const char * fmt, ...) { + int r; + va_list ap; + DBGOUT("printf(%p, ...)\r\n", fmt); + va_start(ap, fmt); + r = _vprintf_r(_impure_ptr, fmt, ap); + va_end(ap); + return r; +} diff --git a/os/src/sbrk.c b/os/src/sbrk.c index bff44a2..eca289a 100644 --- a/os/src/sbrk.c +++ b/os/src/sbrk.c @@ -15,7 +15,8 @@ extern uintptr_t __heap_start, __heap_end; /* Low-level bulk RAM allocator -- used by Newlib's Malloc */ static void *heap_end = NULL; -PRIVILEGED_FUNCTION void *_sbrk_r(struct _reent *ptr, ptrdiff_t incr) + +void *_sbrk_r(struct _reent *ptr, ptrdiff_t incr) { void *prev_heap_end, *next_heap_end, *ret; // void *stack_min = (void *)(__stack_start ? __stack_start : __heap_end); diff --git a/os/src/sprintf.c b/os/src/sprintf.c index 3dc1b2c..9027623 100644 --- a/os/src/sprintf.c +++ b/os/src/sprintf.c @@ -6,7 +6,7 @@ int sprintf(char * str, const char * fmt, ...) { int r; va_list ap; - DBGOUT("sprintf(%p, %s, ...)\r\n", str, fmt); + DBGOUT("sprintf(%p, %p, ...)\r\n", str, fmt); va_start(ap, fmt); r = _vsprintf_r(_impure_ptr, str, fmt, ap); va_end(ap); |