adds newlib-nano settings

This commit is contained in:
eyck committed 2024-01-16 12:26:47 +01:00
1 parent 123f579105
commit f9364c667b
8 files changed
+168 -10

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
#include <stdint.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include "stub.h"
#include <platform.h>
ssize_t _write(int fd, const void* ptr, size_t len);
ssize_t _write(int fd, const void* ptr, size_t len) {
const char * current = (const char *)ptr;
if (isatty(fd)) {
for (size_t jj = 0; jj < len; jj++) {
while (uart_get_tx_free(uart)==0) ;
uart_write(uart, current[jj]);
if (current[jj] == '\n') {
while (uart_get_tx_free(uart)==0) ;
uart_write(uart, '\r');
}
}
return len;
}
return _stub(EBADF);
}