diff options
Diffstat (limited to 'components/libc/newlib/libc.c')
| -rw-r--r-- | components/libc/newlib/libc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/components/libc/newlib/libc.c b/components/libc/newlib/libc.c new file mode 100644 index 0000000000..1f8d7221f0 --- /dev/null +++ b/components/libc/newlib/libc.c @@ -0,0 +1,20 @@ +#include <rtthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+
+void libc_system_init(const char* tty_name)
+{
+ int fd;
+
+ /* init console device */
+ rt_console_init(tty_name);
+
+ /* open console as stdin/stdout/stderr */
+ fd = open("/dev/console", O_RDONLY, 0); /* for stdin */
+ rt_kprintf("stdin: %d\n", fd);
+ fd = open("/dev/console", O_WRONLY, 0); /* for stdout */
+ rt_kprintf("stdout: %d\n", fd);
+ fd = open("/dev/console", O_WRONLY, 0); /* for stderr */
+ rt_kprintf("stderr: %d\n", fd);
+}
|
