From: Florent Kermarrec Date: Tue, 27 Aug 2019 07:45:44 +0000 (+0200) Subject: software/bios: switch to standard CRLF X-Git-Tag: 24jan2021_ls180~1035 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c179741cf31ac338867082d503626f19e841731e;p=litex.git software/bios: switch to standard CRLF Avoid setting terminal to "implicit CR in every LF" mode. --- diff --git a/litex/build/sim/core/modules/serial2console/serial2console.c b/litex/build/sim/core/modules/serial2console/serial2console.c index 12704c42..c32b568f 100644 --- a/litex/build/sim/core/modules/serial2console/serial2console.c +++ b/litex/build/sim/core/modules/serial2console/serial2console.c @@ -72,7 +72,7 @@ void read_handler(int fd, short event, void *arg) struct session_s *s = (struct session_s*)arg; char buffer[1024]; ssize_t read_len; - + int i; read_len = read(fd, buffer, 1024); for(i = 0; i < read_len; i++) { @@ -137,7 +137,7 @@ static int serial2console_add_pads(void *sess, struct pad_list_s *plist) litex_sim_module_pads_get(pads, "source_valid", (void**)&s->tx_valid); litex_sim_module_pads_get(pads, "source_ready", (void**)&s->tx_ready); } - + if(!strcmp(plist->name, "sys_clk")) litex_sim_module_pads_get(pads, "sys_clk", (void**) &s->sys_clk); @@ -154,8 +154,6 @@ static int serial2console_tick(void *sess) { *s->tx_ready = 1; if(*s->tx_valid) { - if(*s->tx == '\n') - printf("\r"); printf("%c", *s->tx); fflush(stdout); } diff --git a/litex/soc/software/libbase/console.c b/litex/soc/software/libbase/console.c index 45fbc574..7861a1d9 100644 --- a/litex/soc/software/libbase/console.c +++ b/litex/soc/software/libbase/console.c @@ -25,6 +25,8 @@ int putchar(int c) uart_write(c); if(write_hook != NULL) write_hook(c); + if (c == '\n') + putchar('\r'); return c; } diff --git a/litex/tools/litex_term.py b/litex/tools/litex_term.py index cee989cb..d4607b63 100755 --- a/litex/tools/litex_term.py +++ b/litex/tools/litex_term.py @@ -152,8 +152,6 @@ class LiteXTerm: signal.signal(signal.SIGINT, self.sigint) self.sigint_time_last = 0 - self.lf_insert = True - def open(self, port, baudrate): if hasattr(self, "port"): return @@ -261,21 +259,10 @@ class LiteXTerm: def reader(self): try: - c_last = 0 while self.reader_alive: c = self.port.read() - if c_last == b"\r": - if c == b"\n": - self.lf_insert = False - else: - self.lf_insert = True - c_last = c - if self.lf_insert and c == b"\r": - sys.stdout.buffer.write(b"\n") - else: - sys.stdout.buffer.write(c) + sys.stdout.buffer.write(c) sys.stdout.flush() - if len(self.mem_regions): if self.serial_boot and self.detect_prompt(c): self.answer_prompt()