mirror of
https://github.com/stnolting/neorv32.git
synced 2025-04-24 14:17:51 -04:00
[newlib] add full linebreak to STD write
This commit is contained in:
parent
d7759cbb33
commit
01c1cdb3ca
1 changed files with 6 additions and 1 deletions
|
@ -113,11 +113,16 @@ int _getpid() {
|
|||
int _write(int file, char *ptr, int len) {
|
||||
|
||||
int write_cnt = 0;
|
||||
char c = 0;
|
||||
|
||||
// write everything (STDOUT, STDERR, ...) to NEORV32.UART0 (if available)
|
||||
if (neorv32_uart0_available()) {
|
||||
while (len > 0) {
|
||||
neorv32_uart0_putc((char)*ptr++);
|
||||
c = (char)*ptr++;
|
||||
if (c == '\n') { // convert \n to \r\n
|
||||
neorv32_uart0_putc('\r');
|
||||
}
|
||||
neorv32_uart0_putc(c);
|
||||
len--;
|
||||
write_cnt++;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue