18static void _putchar_nano(
char character){
19 #if (ENABLE_SEMIHOSTING_PRINT == 1)
25 static char _getchar_nano(){
26 #if (ENABLE_SEMIHOSTING_PRINT == 1)
38const char msg[] =
"\033[31m\nERR: Heap Collision!\n\033[0m";
43 char *prev_heap = heap_ptr;
51 return (ssize_t)prev_heap;
56ssize_t
_write(
int fd,
const void *buf,
size_t count)
60 for (
size_t i = 0; i < count; ++i) {
69 return (ssize_t)count;
72ssize_t
_read(
int fd,
char *buf,
size_t count)
80 char c = _getchar_nano();
83 if (c ==
'\r' || c ==
'\n') {
84#if (ENABLE_SEMIHOSTING_PRINT == 0)
90 return (ssize_t)(i + 1);
94 if (c == 0x08 || c == 0x7F) {
99#if (ENABLE_SEMIHOSTING_PRINT == 0)
110 if (c >=
' ' && c <=
'~') {
112#if (ENABLE_SEMIHOSTING_PRINT == 0)
134 st->st_mode = S_IFCHR;
146off_t
_lseek(
int fd, off_t offset,
int whence)
148 (void)fd; (void)offset; (void)whence;
156 while (1) { __asm__
volatile (
"wfi"); }
162 (void)pid; (void)sig;
#define bsp_getChar()
Map standard character input to the physical UART.
#define bsp_putChar(c)
Map standard character output to the physical UART.
int _kill(int pid, int sig)
int _fstat(int fd, struct stat *st)
off_t _lseek(int fd, off_t offset, int whence)
ssize_t _write(int fd, const void *buf, size_t count)
ssize_t _read(int fd, char *buf, size_t count)