From 19966edb61122c3ebbe16a11f4e35c54effeded9 Mon Sep 17 00:00:00 2001 From: Michal Sieron Date: Thu, 29 Jul 2021 11:41:36 +0200 Subject: [PATCH] Replace putsnonl(s) with fputs(s, stdout) It won't compile, because stdout is undefined, but including headers from picolibc should fix that --- litex/soc/software/bios/helpers.c | 2 +- litex/soc/software/bios/readline_simple.c | 8 ++++---- litex/soc/software/demo/donut.c | 4 ++-- litex/soc/software/demo/main.c | 6 +++--- litex/soc/software/include/base/console.h | 2 -- litex/soc/software/libbase/console.c | 8 -------- 6 files changed, 10 insertions(+), 20 deletions(-) diff --git a/litex/soc/software/bios/helpers.c b/litex/soc/software/bios/helpers.c index 5c1686759..c953a27f1 100644 --- a/litex/soc/software/bios/helpers.c +++ b/litex/soc/software/bios/helpers.c @@ -20,7 +20,7 @@ void dump_bytes(unsigned int *ptr, int count, unsigned long addr) char *data = (char *)ptr; int line_bytes = 0, i = 0; - putsnonl("Memory dump:"); + fputs("Memory dump:", stdout); while (count > 0) { line_bytes = (count > NUMBER_OF_BYTES_ON_A_LINE)? diff --git a/litex/soc/software/bios/readline_simple.c b/litex/soc/software/bios/readline_simple.c index bcf062138..2d4707238 100644 --- a/litex/soc/software/bios/readline_simple.c +++ b/litex/soc/software/bios/readline_simple.c @@ -31,7 +31,7 @@ int readline(char *s, int size) case 0x08: if(ptr > 0) { ptr--; - putsnonl("\x08 \x08"); + fputs("\x08 \x08", stdout); } break; case 0x07: @@ -39,15 +39,15 @@ int readline(char *s, int size) case '\r': skip = '\n'; s[ptr] = 0x00; - putsnonl("\n"); + fputs("\n", stdout); return 0; case '\n': skip = '\r'; s[ptr] = 0x00; - putsnonl("\n"); + fputs("\n", stdout); return 0; default: - putsnonl(c); + fputs(c, stdout); s[ptr] = c[0]; ptr++; break; diff --git a/litex/soc/software/demo/donut.c b/litex/soc/software/demo/donut.c index 956c38040..a96d9a9ac 100644 --- a/litex/soc/software/demo/donut.c +++ b/litex/soc/software/demo/donut.c @@ -62,6 +62,6 @@ void donut(void) { readchar(); break; } - putsnonl("\x1b[23A"); + fputs("\x1b[23A", stdout); } -} \ No newline at end of file +} diff --git a/litex/soc/software/demo/main.c b/litex/soc/software/demo/main.c index f628b5b88..3cf125314 100644 --- a/litex/soc/software/demo/main.c +++ b/litex/soc/software/demo/main.c @@ -28,7 +28,7 @@ static char *readstr(void) case 0x08: if(ptr > 0) { ptr--; - putsnonl("\x08 \x08"); + fputs("\x08 \x08", stdout); } break; case 0x07: @@ -36,13 +36,13 @@ static char *readstr(void) case '\r': case '\n': s[ptr] = 0x00; - putsnonl("\n"); + fputs("\n", stdout); ptr = 0; return s; default: if(ptr >= (sizeof(s) - 1)) break; - putsnonl(c); + fputs(c, stdout); s[ptr] = c[0]; ptr++; break; diff --git a/litex/soc/software/include/base/console.h b/litex/soc/software/include/base/console.h index a1cf59928..5a7a2ff7d 100644 --- a/litex/soc/software/include/base/console.h +++ b/litex/soc/software/include/base/console.h @@ -15,8 +15,6 @@ void console_set_read_hook(console_read_hook r, console_read_nonblock_hook rn); char readchar(void); int readchar_nonblock(void); -void putsnonl(const char *s); - #ifdef __cplusplus } #endif diff --git a/litex/soc/software/libbase/console.c b/litex/soc/software/libbase/console.c index a2a5f129c..1eb5b3b39 100644 --- a/litex/soc/software/libbase/console.c +++ b/litex/soc/software/libbase/console.c @@ -71,11 +71,3 @@ int readchar_nonblock(void) #endif -void putsnonl(const char *s) -{ - while(*s) { - putchar(*s); - s++; - } -} -